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
ec703e63
Commit
ec703e63
authored
May 09, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GIL handling on function exit for re-assigned Python arguments.
parent
c1118bf8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-0
tests/run/with_gil.pyx
tests/run/with_gil.pyx
+14
-0
No files found.
Cython/Compiler/Nodes.py
View file @
ec703e63
...
@@ -2146,6 +2146,7 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -2146,6 +2146,7 @@ class FuncDefNode(StatNode, BlockNode):
if
entry
.
type
.
is_pyobject
:
if
entry
.
type
.
is_pyobject
:
if
entry
.
is_arg
and
not
entry
.
cf_is_reassigned
:
if
entry
.
is_arg
and
not
entry
.
cf_is_reassigned
:
continue
continue
if
entry
.
type
.
needs_refcounting
:
assure_gil
(
'success'
)
assure_gil
(
'success'
)
# FIXME ideally use entry.xdecref_cleanup but this currently isn't reliable
# FIXME ideally use entry.xdecref_cleanup but this currently isn't reliable
code
.
put_var_xdecref
(
entry
,
have_gil
=
gil_owned
[
'success'
])
code
.
put_var_xdecref
(
entry
,
have_gil
=
gil_owned
[
'success'
])
...
@@ -2162,6 +2163,8 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -2162,6 +2163,8 @@ class FuncDefNode(StatNode, BlockNode):
continue
continue
if
not
acquire_gil
and
not
entry
.
cf_is_reassigned
:
if
not
acquire_gil
and
not
entry
.
cf_is_reassigned
:
continue
continue
if
entry
.
type
.
needs_refcounting
:
assure_gil
(
'success'
)
# FIXME use entry.xdecref_cleanup - del arg seems to be the problem
# FIXME use entry.xdecref_cleanup - del arg seems to be the problem
code
.
put_var_xdecref
(
entry
,
have_gil
=
gil_owned
[
'success'
])
code
.
put_var_xdecref
(
entry
,
have_gil
=
gil_owned
[
'success'
])
...
...
tests/run/with_gil.pyx
View file @
ec703e63
...
@@ -478,6 +478,20 @@ cdef void _void_with_python_objects() nogil:
...
@@ -478,6 +478,20 @@ cdef void _void_with_python_objects() nogil:
obj2
=
[
456
]
obj2
=
[
456
]
def
void_with_py_arg_reassigned
(
x
):
"""
>>> void_with_py_arg_reassigned(123)
"""
with
nogil
:
_void_with_py_arg_reassigned
(
x
)
cdef
void
_void_with_py_arg_reassigned
(
x
)
nogil
:
c
=
123
with
gil
:
x
=
[
456
]
cdef
void
test_timing_callback
()
with
gil
:
cdef
void
test_timing_callback
()
with
gil
:
pass
pass
...
...
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