diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2014-01-10 10:50:53 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2014-01-10 10:50:53 +0100 |
commit | ddaffbe78c06e580ca0d9cd334c7a28a4de5c40b (patch) | |
tree | bd501d1c632be0a473cacc7b6ca7ed18f708622a /Cython/Compiler/ModuleNode.py | |
parent | 7280479318572d6a0a6372c01c29badcae2da5de (diff) | |
download | cython-ddaffbe78c06e580ca0d9cd334c7a28a4de5c40b.tar.gz |
call PyBaseObject_Type.tp_new() in tp_new() functions instead of tp_alloc() directly
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index e38d9344e..13d626b03 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1125,7 +1125,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): code.globalstate.use_utility_code( UtilityCode.load_cached("IncludeStringH", "StringTools.c")) obj_struct = type.declaration_code("", deref=True) - code.putln("if (likely((%s > 0) & (t->tp_basicsize == sizeof(%s)))) {" % ( + code.putln("if (likely((%s > 0) & (t->tp_basicsize == sizeof(%s)) & ((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0))) {" % ( freecount_name, obj_struct)) code.putln("o = (PyObject*)%s[--%s];" % ( freelist_name, freecount_name)) @@ -1134,7 +1134,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): if scope.needs_gc(): code.putln("PyObject_GC_Track(o);") code.putln("} else {") - code.putln("o = (*t->tp_alloc)(t, 0);") + code.putln("o = (PyObject *) PyBaseObject_Type.tp_new(t, %s, 0);" % Naming.empty_tuple) code.putln("if (unlikely(!o)) return 0;") if freelist_size and not base_type: code.putln('}') |