summaryrefslogtreecommitdiffstats
path: root/Modules
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 /Modules
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 'Modules')
-rw-r--r--Modules/_asynciomodule.c6
-rw-r--r--Modules/_io/bufferedio.c11
-rw-r--r--Modules/_io/fileio.c6
-rw-r--r--Modules/_io/iobase.c4
-rw-r--r--Modules/_io/textio.c5
-rw-r--r--Modules/_io/winconsoleio.c2
-rw-r--r--Modules/_testmultiphase.c2
-rw-r--r--Modules/gcmodule.c1
-rw-r--r--Modules/posixmodule.c3
-rw-r--r--Modules/socketmodule.c3
-rw-r--r--Modules/xxlimited.c2
11 files changed, 19 insertions, 26 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 6013608..d8b631b 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -1430,8 +1430,7 @@ static PyTypeObject FutureType = {
.tp_dealloc = FutureObj_dealloc,
.tp_as_async = &FutureType_as_async,
.tp_repr = (reprfunc)FutureObj_repr,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_FINALIZE,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
.tp_doc = _asyncio_Future___init____doc__,
.tp_traverse = (traverseproc)FutureObj_traverse,
.tp_clear = (inquiry)FutureObj_clear,
@@ -2461,8 +2460,7 @@ static PyTypeObject TaskType = {
.tp_dealloc = TaskObj_dealloc,
.tp_as_async = &FutureType_as_async,
.tp_repr = (reprfunc)FutureObj_repr,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_FINALIZE,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
.tp_doc = _asyncio_Task___init____doc__,
.tp_traverse = (traverseproc)TaskObj_traverse,
.tp_clear = (inquiry)TaskObj_clear,
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 6f855b9..9c0eeb5 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -2342,8 +2342,7 @@ PyTypeObject PyBufferedIOBase_Type = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
bufferediobase_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -2434,7 +2433,7 @@ PyTypeObject PyBufferedReader_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
_io_BufferedReader___init____doc__, /* tp_doc */
(traverseproc)buffered_traverse, /* tp_traverse */
(inquiry)buffered_clear, /* tp_clear */
@@ -2520,7 +2519,7 @@ PyTypeObject PyBufferedWriter_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
_io_BufferedWriter___init____doc__, /* tp_doc */
(traverseproc)buffered_traverse, /* tp_traverse */
(inquiry)buffered_clear, /* tp_clear */
@@ -2597,7 +2596,7 @@ PyTypeObject PyBufferedRWPair_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /* tp_flags */
+ | Py_TPFLAGS_HAVE_GC, /* tp_flags */
_io_BufferedRWPair___init____doc__, /* tp_doc */
(traverseproc)bufferedrwpair_traverse, /* tp_traverse */
(inquiry)bufferedrwpair_clear, /* tp_clear */
@@ -2691,7 +2690,7 @@ PyTypeObject PyBufferedRandom_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
_io_BufferedRandom___init____doc__, /* tp_doc */
(traverseproc)buffered_traverse, /* tp_traverse */
(inquiry)buffered_clear, /* tp_clear */
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 52a6f49..582a813 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -1200,12 +1200,12 @@ PyTypeObject PyFileIO_Type = {
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /* tp_flags */
+ | Py_TPFLAGS_HAVE_GC, /* tp_flags */
_io_FileIO___init____doc__, /* tp_doc */
(traverseproc)fileio_traverse, /* tp_traverse */
(inquiry)fileio_clear, /* tp_clear */
0, /* tp_richcompare */
- offsetof(fileio, weakreflist), /* tp_weaklistoffset */
+ offsetof(fileio, weakreflist), /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
fileio_methods, /* tp_methods */
@@ -1215,7 +1215,7 @@ PyTypeObject PyFileIO_Type = {
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
- offsetof(fileio, dict), /* tp_dictoffset */
+ offsetof(fileio, dict), /* tp_dictoffset */
_io_FileIO___init__, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
fileio_new, /* tp_new */
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index a5727b8..8c8112d 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -856,7 +856,7 @@ PyTypeObject PyIOBase_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
iobase_doc, /* tp_doc */
(traverseproc)iobase_traverse, /* tp_traverse */
(inquiry)iobase_clear, /* tp_clear */
@@ -1051,7 +1051,7 @@ PyTypeObject PyRawIOBase_Type = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
rawiobase_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index a08ab5b..3eb0dcc 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -183,8 +183,7 @@ PyTypeObject PyTextIOBase_Type = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
textiobase_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -3258,7 +3257,7 @@ PyTypeObject PyTextIOWrapper_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
_io_TextIOWrapper___init____doc__, /* tp_doc */
(traverseproc)textiowrapper_traverse, /* tp_traverse */
(inquiry)textiowrapper_clear, /* tp_clear */
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index 70a723e..7700bd5 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -1133,7 +1133,7 @@ PyTypeObject PyWindowsConsoleIO_Type = {
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /* tp_flags */
+ | Py_TPFLAGS_HAVE_GC, /* tp_flags */
_io__WindowsConsoleIO___init____doc__, /* tp_doc */
(traverseproc)winconsoleio_traverse, /* tp_traverse */
(inquiry)winconsoleio_clear, /* tp_clear */
diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c
index db5bb7d..4933abb 100644
--- a/Modules/_testmultiphase.c
+++ b/Modules/_testmultiphase.c
@@ -98,7 +98,7 @@ static PyType_Spec Example_Type_spec = {
"_testimportexec.Example",
sizeof(ExampleObject),
0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
Example_Type_slots
};
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 3b15c7b..0cf00e8 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -858,7 +858,6 @@ finalize_garbage(PyGC_Head *collectable)
PyObject *op = FROM_GC(gc);
gc_list_move(gc, &seen);
if (!_PyGCHead_FINALIZED(gc) &&
- PyType_HasFeature(Py_TYPE(op), Py_TPFLAGS_HAVE_FINALIZE) &&
(finalize = Py_TYPE(op)->tp_finalize) != NULL) {
_PyGCHead_SET_FINALIZED(gc);
Py_INCREF(op);
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index a3d979c..a25ff7a 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -13032,8 +13032,7 @@ static PyTypeObject ScandirIteratorType = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT
- | Py_TPFLAGS_HAVE_FINALIZE, /* tp_flags */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 74cdc0f..ca4d760 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -5286,8 +5286,7 @@ static PyTypeObject sock_type = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_FINALIZE, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
sock_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c
index 190f993..ffc04e0 100644
--- a/Modules/xxlimited.c
+++ b/Modules/xxlimited.c
@@ -123,7 +123,7 @@ static PyType_Spec Xxo_Type_spec = {
"xxlimited.Xxo",
sizeof(XxoObject),
0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
Xxo_Type_slots
};