Commit 77092108 authored by Stefan Behnel's avatar Stefan Behnel

Use "!" instead of the less clear "== 0" when testing for type features.

parent f9240f2e
......@@ -1454,7 +1454,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if is_final_type:
type_safety_check = ''
else:
type_safety_check = ' & (__Pyx_PyType_HasFeature(t, (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)) == 0)'
type_safety_check = ' & (!__Pyx_PyType_HasFeature(t, (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))'
obj_struct = type.declaration_code("", deref=True)
code.putln(
"if (CYTHON_COMPILING_IN_CPYTHON && likely((%s > 0) & (t->tp_basicsize == sizeof(%s))%s)) {" % (
......@@ -1467,7 +1467,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("PyObject_GC_Track(o);")
code.putln("} else {")
if not is_final_type:
code.putln("if (likely(__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT) == 0)) {")
code.putln("if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {")
code.putln("o = (*t->tp_alloc)(t, 0);")
if not is_final_type:
code.putln("} else {")
......@@ -1660,7 +1660,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
type_safety_check = ''
else:
type_safety_check = (
' & (__Pyx_PyType_HasFeature(Py_TYPE(o), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)) == 0)')
' & (!__Pyx_PyType_HasFeature(Py_TYPE(o), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))')
type = scope.parent_type
code.putln(
......
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