bpo-42747: Remove Py_TPFLAGS_HAVE_AM_SEND and make Py_TPFLAGS_HAVE_VERSION_TAG no-op (GH-27260)

* Remove code that checks Py_TPFLAGS_HAVE_VERSION_TAG
    
    The field is always present in the type struct, as explained
    in the added comment.

* Remove Py_TPFLAGS_HAVE_AM_SEND
    
    The flag is not needed, and since it was added in 3.10 it can be removed now.
This commit is contained in:
Petr Viktorin 2021-07-23 15:21:11 +02:00 committed by GitHub
parent 7d28a6eb90
commit a4760cc32d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 56 deletions

View file

@ -368,18 +368,12 @@ given type object has a specified feature.
/* Objects behave like an unbound method */
#define Py_TPFLAGS_METHOD_DESCRIPTOR (1UL << 17)
/* Objects support type attribute cache */
#define Py_TPFLAGS_HAVE_VERSION_TAG (1UL << 18)
/* Object has up-to-date type attribute cache */
#define Py_TPFLAGS_VALID_VERSION_TAG (1UL << 19)
/* Type is abstract and cannot be instantiated */
#define Py_TPFLAGS_IS_ABSTRACT (1UL << 20)
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
/* Type has am_send entry in tp_as_async slot */
#define Py_TPFLAGS_HAVE_AM_SEND (1UL << 21)
#endif
// This undocumented flag gives certain built-ins their unique pattern-matching
// behavior, which allows a single positional subpattern to match against the
// subject itself (rather than a mapped attribute on it):
@ -397,19 +391,23 @@ given type object has a specified feature.
#define Py_TPFLAGS_DEFAULT ( \
Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
Py_TPFLAGS_HAVE_VERSION_TAG | \
0)
/* NOTE: The following flags reuse lower bits (removed as part of the
/* NOTE: Some of the following flags reuse lower bits (removed as part of the
* Python 3.0 transition). */
/* The following flag is kept for compatibility. Starting with 3.8,
* binary compatibility of C extensions across feature releases of
* Python is not supported anymore, except when using the stable ABI.
/* The following flags are kept for compatibility; in previous
* versions they indicated presence of newer tp_* fields on the
* type struct.
* Starting with 3.8, binary compatibility of C extensions across
* feature releases of Python is not supported anymore (except when
* using the stable ABI, in which all classes are created dynamically,
* using the interpreter's memory layout.)
* Note that older extensions using the stable ABI set these flags,
* so the bits must not be repurposed.
*/
/* Type structure has tp_finalize member (3.4) */
#define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0)
#define Py_TPFLAGS_HAVE_VERSION_TAG (1UL << 18)
/*