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

Avoid unlocking never-locked objects at the end of functions

parent 2508d906
......@@ -2216,7 +2216,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