bpo-32388: Remove cross-version binary compatibility requirement in tp_flags (GH-4944)

It is now allowed to add new fields at the end of the PyTypeObject struct without having to allocate a dedicated compatibility flag in tp_flags.

This will reduce the risk of running out of bits in the 32-bit tp_flags value.
This commit is contained in:
Antoine Pitrou 2019-05-29 22:12:38 +02:00 committed by GitHub
parent 43fdbd2729
commit ada319bb6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 52 additions and 51 deletions

View file

@ -298,10 +298,7 @@ PyObject_CallFinalizer(PyObject *self)
{
PyTypeObject *tp = Py_TYPE(self);
/* The former could happen on heaptypes created from the C API, e.g.
PyType_FromSpec(). */
if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_FINALIZE) ||
tp->tp_finalize == NULL)
if (tp->tp_finalize == NULL)
return;
/* tp_finalize should only be called once. */
if (PyType_IS_GC(tp) && _PyGC_FINALIZED(self))