summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ModuleNode.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2014-03-10 21:19:24 +0100
committerStefan Behnel <stefan_ml@behnel.de>2014-03-10 21:19:24 +0100
commit895e20615f4c42c53c27e4c2c4266757e390ded8 (patch)
tree09f79d6452063d223059282740e49e94263f292f /Cython/Compiler/ModuleNode.py
parentcbb627eeefdb3ddad217b59d218ac8ad15baf5e2 (diff)
downloadcython-895e20615f4c42c53c27e4c2c4266757e390ded8.tar.gz
restrict freelist usage to CPython
--HG-- extra : amend_source : 9ae2e52935ae16af23c35b6329d53e559b7c39d0
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r--Cython/Compiler/ModuleNode.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 1612ccb86..36c015a70 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -1174,7 +1174,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
else:
type_safety_check = ' & ((t->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)) == 0)'
obj_struct = type.declaration_code("", deref=True)
- code.putln("if (likely((%s > 0) & (t->tp_basicsize == sizeof(%s))%s)) {" % (
+ code.putln("if (CYTHON_COMPILING_IN_CPYTHON && likely((%s > 0) & (t->tp_basicsize == sizeof(%s))%s)) {" % (
freecount_name, obj_struct, type_safety_check))
code.putln("o = (PyObject*)%s[--%s];" % (
freelist_name, freecount_name))
@@ -1347,7 +1347,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
' & ((Py_TYPE(o)->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)) == 0)')
type = scope.parent_type
- code.putln("if ((%s < %d) & (Py_TYPE(o)->tp_basicsize == sizeof(%s))%s) {" % (
+ code.putln("if (CYTHON_COMPILING_IN_CPYTHON && ((%s < %d) & (Py_TYPE(o)->tp_basicsize == sizeof(%s))%s)) {" % (
freecount_name, freelist_size, type.declaration_code("", deref=True),
type_safety_check))
code.putln("%s[%s++] = %s;" % (