Author vstinner
Recipients corona10, petr.viktorin, pitrou, serhiy.storchaka, shihai1991, vstinner
Date 2020-12-30.01:22:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609291362.45.0.874980425144.issue42747@roundup.psfhosted.org>
In-reply-to
Content
Ah, I see that there is a misunderstanding. The flag is used for two things:

(*) Create/Declare a type

IMO Py_TPFLAGS_HAVE_VERSION_TAG and Py_TPFLAGS_HAVE_FINALIZE are useless for that.

(*) Check if a type has the flag

An extension built with the stable ABI *can* use PyType_HasFeature(type, Py_TPFLAGS_HAVE_VERSION_TAG).

I'm only aware of PyQt which uses the stable ABI. Is there other projects using it? Do these projects check for Py_TPFLAGS_HAVE_VERSION_TAG or Py_TPFLAGS_HAVE_FINALIZE flag?

If we cannot be used that no extension module built with the stable ABI for these flags, the safe option is to keep them, deprecate them, and always define them. For example, add the flags to Py_TPFLAGS_DEFAULT and/or add them in type_new() or PyType_Ready().

--

Py_TPFLAGS_HAVE_VERSION_TAG is really an internal tag. It should only be used by _PyType_Lookup().

I'm not sure why someone would like to check explicitly for the Py_TPFLAGS_HAVE_FINALIZE flag. I would expect that only Python internals call the tp_finalize slot.
History
Date User Action Args
2020-12-30 01:22:42vstinnersetrecipients: + vstinner, pitrou, petr.viktorin, serhiy.storchaka, corona10, shihai1991
2020-12-30 01:22:42vstinnersetmessageid: <1609291362.45.0.874980425144.issue42747@roundup.psfhosted.org>
2020-12-30 01:22:42vstinnerlinkissue42747 messages
2020-12-30 01:22:42vstinnercreate