STINNER Victor <vstin...@python.org> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42747>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to