Commit ec703e63 authored by Stefan Behnel's avatar Stefan Behnel

Fix GIL handling on function exit for re-assigned Python arguments.

parent c1118bf8
......@@ -2146,6 +2146,7 @@ class FuncDefNode(StatNode, BlockNode):
if entry.type.is_pyobject:
if entry.is_arg and not entry.cf_is_reassigned:
continue
if entry.type.needs_refcounting:
assure_gil('success')
# FIXME ideally use entry.xdecref_cleanup but this currently isn't reliable
code.put_var_xdecref(entry, have_gil=gil_owned['success'])
......@@ -2162,6 +2163,8 @@ class FuncDefNode(StatNode, BlockNode):
continue
if not acquire_gil and not entry.cf_is_reassigned:
continue
if entry.type.needs_refcounting:
assure_gil('success')
# FIXME use entry.xdecref_cleanup - del arg seems to be the problem
code.put_var_xdecref(entry, have_gil=gil_owned['success'])
......
......@@ -478,6 +478,20 @@ cdef void _void_with_python_objects() nogil:
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:
pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment