Commit ea85d044 authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Fix #444 (utility code not pulled in in corner case)

parent 3a2a66e2
...@@ -245,8 +245,9 @@ def put_acquire_arg_buffer(entry, code, pos): ...@@ -245,8 +245,9 @@ def put_acquire_arg_buffer(entry, code, pos):
# need to care about the buffer then. # need to care about the buffer then.
put_unpack_buffer_aux_into_scope(buffer_aux, entry.type.mode, code) put_unpack_buffer_aux_into_scope(buffer_aux, entry.type.mode, code)
def get_release_buffer_code(entry): def put_release_buffer_code(code, entry):
return "__Pyx_SafeReleaseBuffer(&%s)" % entry.buffer_aux.buffer_info_var.cname code.globalstate.use_utility_code(acquire_utility_code)
code.putln("__Pyx_SafeReleaseBuffer(&%s);" % entry.buffer_aux.buffer_info_var.cname)
def get_getbuffer_call(code, obj_cname, buffer_aux, buffer_type): def get_getbuffer_call(code, obj_cname, buffer_aux, buffer_type):
ndim = buffer_type.ndim ndim = buffer_type.ndim
......
...@@ -1143,7 +1143,7 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -1143,7 +1143,7 @@ class FuncDefNode(StatNode, BlockNode):
code.putln("{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;") code.putln("{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;")
code.putln("__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);") code.putln("__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);")
for entry in lenv.buffer_entries: for entry in lenv.buffer_entries:
code.putln("%s;" % Buffer.get_release_buffer_code(entry)) Buffer.put_release_buffer_code(code, entry)
#code.putln("%s = 0;" % entry.cname) #code.putln("%s = 0;" % entry.cname)
code.putln("__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}") code.putln("__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}")
...@@ -1185,7 +1185,7 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -1185,7 +1185,7 @@ class FuncDefNode(StatNode, BlockNode):
code.put_label(code.return_label) code.put_label(code.return_label)
for entry in lenv.buffer_entries: for entry in lenv.buffer_entries:
if entry.used: if entry.used:
code.putln("%s;" % Buffer.get_release_buffer_code(entry)) Buffer.put_release_buffer_code(code, entry)
if is_getbuffer_slot: if is_getbuffer_slot:
self.getbuffer_normal_cleanup(code) self.getbuffer_normal_cleanup(code)
# ----- Return cleanup for both error and no-error return # ----- Return cleanup for both error and no-error return
......
def test():
cdef object[int] not_assigned_to
not_assigned_to[2] = 3
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