Skip to content

Commit 91ccfc4

Browse files
committed
Remove Py_TPFLAGS_HAVE_AM_SEND
The flag is not needed.
1 parent bdad9e8 commit 91ccfc4

File tree

6 files changed

+5
-32
lines changed

6 files changed

+5
-32
lines changed

Doc/c-api/typeobj.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,14 +1178,6 @@ and :c:type:`PyType_Type` effectively act as defaults.)
11781178

11791179
.. versionadded:: 3.9
11801180

1181-
1182-
.. data:: Py_TPFLAGS_HAVE_AM_SEND
1183-
1184-
This bit is set when the :c:member:`~PyAsyncMethods.am_send` entry is present in the
1185-
:c:member:`~PyTypeObject.tp_as_async` slot of type structure.
1186-
1187-
.. versionadded:: 3.10
1188-
11891181
.. data:: Py_TPFLAGS_IMMUTABLETYPE
11901182

11911183
This bit is set for type objects that are immutable: type attributes cannot be set nor deleted.

Include/object.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,6 @@ given type object has a specified feature.
374374
/* Type is abstract and cannot be instantiated */
375375
#define Py_TPFLAGS_IS_ABSTRACT (1UL << 20)
376376

377-
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
378-
/* Type has am_send entry in tp_as_async slot */
379-
#define Py_TPFLAGS_HAVE_AM_SEND (1UL << 21)
380-
#endif
381-
382377
// This undocumented flag gives certain built-ins their unique pattern-matching
383378
// behavior, which allows a single positional subpattern to match against the
384379
// subject itself (rather than a mapped attribute on it):

Modules/_asynciomodule.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,8 +1764,7 @@ static PyTypeObject FutureIterType = {
17641764
.tp_dealloc = (destructor)FutureIter_dealloc,
17651765
.tp_as_async = &FutureIterType_as_async,
17661766
.tp_getattro = PyObject_GenericGetAttr,
1767-
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
1768-
Py_TPFLAGS_HAVE_AM_SEND,
1767+
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
17691768
.tp_traverse = (traverseproc)FutureIter_traverse,
17701769
.tp_iter = PyObject_SelfIter,
17711770
.tp_iternext = (iternextfunc)FutureIter_iternext,

Objects/abstract.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2804,9 +2804,7 @@ PyIter_Send(PyObject *iter, PyObject *arg, PyObject **result)
28042804
_Py_IDENTIFIER(send);
28052805
assert(arg != NULL);
28062806
assert(result != NULL);
2807-
if (PyType_HasFeature(Py_TYPE(iter), Py_TPFLAGS_HAVE_AM_SEND)) {
2808-
assert (Py_TYPE(iter)->tp_as_async != NULL);
2809-
assert (Py_TYPE(iter)->tp_as_async->am_send != NULL);
2807+
if (Py_TYPE(iter)->tp_as_async && Py_TYPE(iter)->tp_as_async->am_send) {
28102808
PySendResult res = Py_TYPE(iter)->tp_as_async->am_send(iter, arg, result);
28112809
assert(_Py_CheckSlotResult(iter, "am_send", res != PYGEN_ERROR));
28122810
return res;

Objects/genobject.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,7 @@ PyTypeObject PyGen_Type = {
782782
PyObject_GenericGetAttr, /* tp_getattro */
783783
0, /* tp_setattro */
784784
0, /* tp_as_buffer */
785-
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
786-
Py_TPFLAGS_HAVE_AM_SEND, /* tp_flags */
785+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
787786
0, /* tp_doc */
788787
(traverseproc)gen_traverse, /* tp_traverse */
789788
0, /* tp_clear */
@@ -1029,8 +1028,7 @@ PyTypeObject PyCoro_Type = {
10291028
PyObject_GenericGetAttr, /* tp_getattro */
10301029
0, /* tp_setattro */
10311030
0, /* tp_as_buffer */
1032-
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
1033-
Py_TPFLAGS_HAVE_AM_SEND, /* tp_flags */
1031+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
10341032
0, /* tp_doc */
10351033
(traverseproc)gen_traverse, /* tp_traverse */
10361034
0, /* tp_clear */
@@ -1415,8 +1413,7 @@ PyTypeObject PyAsyncGen_Type = {
14151413
PyObject_GenericGetAttr, /* tp_getattro */
14161414
0, /* tp_setattro */
14171415
0, /* tp_as_buffer */
1418-
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
1419-
Py_TPFLAGS_HAVE_AM_SEND, /* tp_flags */
1416+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
14201417
0, /* tp_doc */
14211418
(traverseproc)async_gen_traverse, /* tp_traverse */
14221419
0, /* tp_clear */

Objects/typeobject.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5967,14 +5967,6 @@ type_ready_pre_checks(PyTypeObject *type)
59675967
_PyObject_ASSERT((PyObject *)type, type->tp_call != NULL);
59685968
}
59695969

5970-
/* Consistency check for Py_TPFLAGS_HAVE_AM_SEND - flag requires
5971-
* type->tp_as_async->am_send to be present.
5972-
*/
5973-
if (type->tp_flags & Py_TPFLAGS_HAVE_AM_SEND) {
5974-
_PyObject_ASSERT((PyObject *)type, type->tp_as_async != NULL);
5975-
_PyObject_ASSERT((PyObject *)type, type->tp_as_async->am_send != NULL);
5976-
}
5977-
59785970
/* Consistency checks for pattern matching
59795971
* Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING are mutually exclusive */
59805972
_PyObject_ASSERT((PyObject *)type, (type->tp_flags & COLLECTION_FLAGS) != COLLECTION_FLAGS);

0 commit comments

Comments
 (0)