Commit 8c941d9d authored by Stefan Behnel's avatar Stefan Behnel

make cleanup safety fix more explicit

parent 51f3877e
...@@ -2010,24 +2010,25 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -2010,24 +2010,25 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
for entry in rev_entries: for entry in rev_entries:
if entry.visibility != 'extern': if entry.visibility != 'extern':
if entry.type.is_pyobject and entry.used: if entry.type.is_pyobject and entry.used:
code.put_decref_clear(entry.cname, code.put_xdecref_clear(
entry.type, entry.cname, entry.type,
clear_before_decref=True, clear_before_decref=True,
nanny=False) nanny=False)
code.putln("__Pyx_CleanupGlobals();") code.putln("__Pyx_CleanupGlobals();")
if Options.generate_cleanup_code >= 3: if Options.generate_cleanup_code >= 3:
code.putln("/*--- Type import cleanup code ---*/") code.putln("/*--- Type import cleanup code ---*/")
for type, _ in env.types_imported.items(): for type in env.types_imported:
code.put_decref_clear(type.typeptr_cname, type, code.put_xdecref_clear(
clear_before_decref=True, type.typeptr_cname, type,
nanny=False) clear_before_decref=True,
nanny=False)
if Options.cache_builtins: if Options.cache_builtins:
code.putln("/*--- Builtin cleanup code ---*/") code.putln("/*--- Builtin cleanup code ---*/")
for entry in env.cached_builtins: for entry in env.cached_builtins:
code.put_decref_clear(entry.cname, code.put_xdecref_clear(
PyrexTypes.py_object_type, entry.cname, PyrexTypes.py_object_type,
clear_before_decref=True, clear_before_decref=True,
nanny=False) nanny=False)
code.putln("/*--- Intern cleanup code ---*/") code.putln("/*--- Intern cleanup code ---*/")
code.put_decref_clear(Naming.empty_tuple, code.put_decref_clear(Naming.empty_tuple,
PyrexTypes.py_object_type, PyrexTypes.py_object_type,
......
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