From 81026937e1d5eb39284a0efc65e12e1c8cfc183c Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 27 Jul 2013 07:52:50 +0200 Subject: avoid traversing/clearing exttype attributes with simple types during garbage collection --- Cython/Compiler/ModuleNode.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'Cython/Compiler/ModuleNode.py') diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index fc78e94c6..6f2a11488 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1290,8 +1290,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): "static int %s(PyObject *o, visitproc v, void *a) {" % slot_func) - have_entries, (py_attrs, py_buffers, - memoryview_slices) = scope.get_refcounted_entries() + have_entries, (py_attrs, py_buffers, memoryview_slices) = ( + scope.get_refcounted_entries(include_gc_simple=False)) if base_type or py_attrs: code.putln("int e;") @@ -1354,13 +1354,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): if tp_slot.slot_code(scope) != slot_func: return # never used - py_attrs = [] - py_buffers = [] - for entry in scope.var_entries: - if entry.type.is_pyobject and entry.name != "__weakref__": - py_attrs.append(entry) - if entry.type == PyrexTypes.c_py_buffer_type: - py_buffers.append(entry) + have_entries, (py_attrs, py_buffers, memoryview_slices) = ( + scope.get_refcounted_entries(include_gc_simple=False)) if py_attrs or py_buffers or base_type: unused = '' -- cgit v1.2.1