Commit af8dcdb3 authored by Xavier Thompson's avatar Xavier Thompson

Make cypclass automatic lock acquisition be flat and never nested

parent bc3b8ae5
...@@ -14181,7 +14181,6 @@ class CoerceToLockedNode(CoercionNode): ...@@ -14181,7 +14181,6 @@ class CoerceToLockedNode(CoercionNode):
self.rlock_only = rlock_only self.rlock_only = rlock_only
self.type = arg.type self.type = arg.type
temp_arg = arg.coerce_to_temp(env) temp_arg = arg.coerce_to_temp(env)
temp_arg.postpone_subexpr_disposal = True
# Avoid incrementing the reference count when assigning to the temporary # Avoid incrementing the reference count when assigning to the temporary
# but ensure it will be decremented if it was already incremented previously. # but ensure it will be decremented if it was already incremented previously.
self.needs_decref = not temp_arg.use_managed_ref self.needs_decref = not temp_arg.use_managed_ref
...@@ -14224,9 +14223,9 @@ class CoerceToLockedNode(CoercionNode): ...@@ -14224,9 +14223,9 @@ class CoerceToLockedNode(CoercionNode):
def generate_disposal_code(self, code): def generate_disposal_code(self, code):
# Close the scope to release the lock. # Close the scope to release the lock.
code.putln("}") code.putln("}")
# Dispose of and free subexpressions. # The subexpressions of self.arg are disposed-of and freed
self.arg.generate_subexpr_disposal_code(code) # as soon as self.arg is evaluated because it is a temporary.
self.arg.free_subexpr_temps(code)
# Decref only if previously incref-ed. # Decref only if previously incref-ed.
if self.needs_decref: if self.needs_decref:
code.put_xdecref_clear(self.result(), self.ctype(), have_gil=not self.in_nogil_context) code.put_xdecref_clear(self.result(), self.ctype(), have_gil=not self.in_nogil_context)
......
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