diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-07-08 10:48:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 10:48:01 (GMT) |
commit | a3739b207adb5d17e3b53347df05b54b1a8b87f0 (patch) | |
tree | 682f352648cabd6de5440fafa8fd4e9f6246f76b /Objects | |
parent | 15f0fc571c1fbc84b6b74dfeb373ca3d35e4c5d7 (diff) | |
download | cpython-a3739b207adb5d17e3b53347df05b54b1a8b87f0.zip cpython-a3739b207adb5d17e3b53347df05b54b1a8b87f0.tar.gz cpython-a3739b207adb5d17e3b53347df05b54b1a8b87f0.tar.bz2 |
bpo-43908: Immutable types inherit vectorcall (GH-27001)
Heap types with the Py_TPFLAGS_IMMUTABLETYPE flag can now inherit the
PEP 590 vectorcall protocol. Previously, this was only possible for static types.
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 116ac14..02ea618 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5881,8 +5881,8 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base) /* Inherit Py_TPFLAGS_HAVE_VECTORCALL for non-heap types * if tp_call is not overridden */ if (!type->tp_call && - (base->tp_flags & Py_TPFLAGS_HAVE_VECTORCALL) && - !(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) + _PyType_HasFeature(base, Py_TPFLAGS_HAVE_VECTORCALL) && + _PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE)) { type->tp_flags |= Py_TPFLAGS_HAVE_VECTORCALL; } @@ -5915,8 +5915,8 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base) * but only for extension types */ if (base->tp_descr_get && type->tp_descr_get == base->tp_descr_get && - !(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && - (base->tp_flags & Py_TPFLAGS_METHOD_DESCRIPTOR)) + _PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE) && + _PyType_HasFeature(base, Py_TPFLAGS_METHOD_DESCRIPTOR)) { type->tp_flags |= Py_TPFLAGS_METHOD_DESCRIPTOR; } |