diff options
author | AlexSm <[email protected]> | 2023-12-22 17:10:22 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2023-12-22 17:10:22 +0100 |
commit | 148f920350c60c0ca2d89b637a5aea9093eee450 (patch) | |
tree | 6314b1433dac833398c333731e83f0ad77e81a0b /contrib/tools/cython/Cython/Compiler/ModuleNode.py | |
parent | 7116d46ae7c0259b5f9d489de263f8701e432b1c (diff) |
Library import 2 (#639)
Diffstat (limited to 'contrib/tools/cython/Cython/Compiler/ModuleNode.py')
-rw-r--r-- | contrib/tools/cython/Cython/Compiler/ModuleNode.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/tools/cython/Cython/Compiler/ModuleNode.py b/contrib/tools/cython/Cython/Compiler/ModuleNode.py index fd998d419fc..ff217bb4e75 100644 --- a/contrib/tools/cython/Cython/Compiler/ModuleNode.py +++ b/contrib/tools/cython/Cython/Compiler/ModuleNode.py @@ -1515,7 +1515,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): if base_type.scope and base_type.scope.needs_gc(): code.putln("PyObject_GC_Track(o);") else: - code.putln("if (PyType_IS_GC(%s)) PyObject_GC_Track(o);" % base_cname) + # Need to check type pointer, see comment on dealloc call below. + code.putln("if (%sPyType_IS_GC(%s)) PyObject_GC_Track(o);" % ( + "" if base_type.is_builtin_type else "likely(%s) && " % base_cname, + base_cname)) tp_dealloc = TypeSlots.get_base_slot_function(scope, tp_slot) if tp_dealloc is not None: |