Commit 6947db1c authored by Stefan Behnel's avatar Stefan Behnel

Avoid checking Py_TPFLAGS_HAVE_FINALIZE in Py3.8 and later since CPython now...

Avoid checking Py_TPFLAGS_HAVE_FINALIZE in Py3.8 and later since CPython now relies on the feature being there.
parent c8190c4d
...@@ -1458,7 +1458,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1458,7 +1458,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
finalised_check = ( finalised_check = (
'(!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))') '(!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))')
code.putln( code.putln(
"if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)" "if (unlikely("
"(PY_VERSION_HEX >= 0x03080000 || PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE))"
" && Py_TYPE(o)->tp_finalize) && %s) {" % finalised_check) " && Py_TYPE(o)->tp_finalize) && %s) {" % finalised_check)
# if instance was resurrected by finaliser, return # if instance was resurrected by finaliser, return
code.putln("if (PyObject_CallFinalizerFromDealloc(o)) return;") code.putln("if (PyObject_CallFinalizerFromDealloc(o)) return;")
......
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