summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorAntoine Pitrou <antoine@python.org>2019-05-29 20:12:38 (GMT)
committerGitHub <noreply@github.com>2019-05-29 20:12:38 (GMT)
commitada319bb6d0ebcc68d3e0ef2b4279ea061877ac8 (patch)
treee908340371be04bce6b7676fd5f034aff3591a4a /Include
parent43fdbd2729cb7cdbb5afb5d16352f6604859e564 (diff)
downloadcpython-ada319bb6d0ebcc68d3e0ef2b4279ea061877ac8.zip
cpython-ada319bb6d0ebcc68d3e0ef2b4279ea061877ac8.tar.gz
cpython-ada319bb6d0ebcc68d3e0ef2b4279ea061877ac8.tar.bz2
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.
Diffstat (limited to 'Include')
-rw-r--r--Include/object.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/Include/object.h b/Include/object.h
index 11ba2bb..cc98d8a 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -263,17 +263,14 @@ PyAPI_FUNC(void) Py_ReprLeave(PyObject *);
#define Py_PRINT_RAW 1 /* No string quotes etc. */
/*
-`Type flags (tp_flags)
+Type flags (tp_flags)
-These flags are used to extend the type structure in a backwards-compatible
-fashion. Extensions can use the flags to indicate (and test) when a given
-type structure contains a new feature. The Python core will use these when
-introducing new functionality between major revisions (to avoid mid-version
-changes in the PYTHON_API_VERSION).
+These flags are used to change expected features and behavior for a
+particular type.
Arbitration of the flag bit positions will need to be coordinated among
all extension writers who publicly release their extensions (this will
-be fewer than you might expect!)..
+be fewer than you might expect!).
Most flags were removed as of Python 3.0 to make room for new flags. (Some
flags are not for backwards compatibility but to indicate the presence of an
@@ -302,7 +299,7 @@ given type object has a specified feature.
/* Set while the type is being 'readied', to prevent recursive ready calls */
#define Py_TPFLAGS_READYING (1UL << 13)
-/* Objects support garbage collection (see objimp.h) */
+/* Objects support garbage collection (see objimpl.h) */
#define Py_TPFLAGS_HAVE_GC (1UL << 14)
/* These two bits are preserved for Stackless Python, next after this is 17 */
@@ -340,6 +337,11 @@ given type object has a specified feature.
/* NOTE: 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 accross feature releases of
+ * Python is not supported anymore, except when using the stable ABI.
+ */
+
/* Type structure has tp_finalize member (3.4) */
#define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0)