Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
f6c850d1
Commit
f6c850d1
authored
Jul 03, 2021
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a refcounting bug in the new @total_ordering decorator.
See
https://github.com/cython/cython/pull/3626
parent
ec945fe3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+2
-2
tests/run/exttype_total_ordering.pyx
tests/run/exttype_total_ordering.pyx
+3
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
f6c850d1
...
...
@@ -2148,11 +2148,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# Implement the and/or check with an if.
if
comp_op
==
'&&'
:
code
.
putln
(
"if (%s order_res) {"
%
(
'!!'
if
invert_comp
else
'!'
))
code
.
putln
(
"ret =
Py_False
;"
)
code
.
putln
(
"ret =
__Pyx_NewRef(Py_False)
;"
)
code
.
putln
(
"} else {"
)
elif
comp_op
==
'||'
:
code
.
putln
(
"if (%s order_res) {"
%
(
'!'
if
invert_comp
else
''
))
code
.
putln
(
"ret =
Py_True
;"
)
code
.
putln
(
"ret =
__Pyx_NewRef(Py_True)
;"
)
code
.
putln
(
"} else {"
)
else
:
raise
AssertionError
(
'Unknown op %s'
%
(
comp_op
,
))
...
...
tests/run/exttype_total_ordering.pyx
View file @
f6c850d1
...
...
@@ -39,6 +39,9 @@ def test_all_comp(cls):
expected
=
func
(
left
.
value
,
right
.
value
)
try
:
result
=
func
(
left
,
right
)
# repeat to rule out deallocation bugs (and assert determinism)
for
_
in
range
(
10
):
assert
result
==
func
(
left
,
right
)
except
TypeError
:
print
(
"TypeError:"
,
left
.
value
,
comp
,
right
.
value
)
succeeded
=
False
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment