Commit aa73f5f8 authored by gsamain's avatar gsamain Committed by Xavier Thompson

Avoid unlocking never-locked objects at the end of functions

parent 5dd7ced5
......@@ -2241,7 +2241,8 @@ class FuncDefNode(StatNode, BlockNode):
code.put_var_xdecref(entry, have_gil=gil_owned['success'])
for node in lenv.autolocked_nodes:
code.putln("Cy_UNLOCK(%s);" % node.result())
if node.entry.needs_rlock or node.entry.needs_wlock:
code.putln("Cy_UNLOCK(%s);" % node.result())
# Decref any increfed args
for entry in lenv.arg_entries:
......
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