bpo-43908: Immutable types inherit vectorcall (GH-27001) · python/cpython@a3739b2 · GitHub
Skip to content

Commit a3739b2

Browse files
Erlend Egeberg Aaslandvstinner
andauthored
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>
1 parent 15f0fc5 commit a3739b2

5 files changed

Lines changed: 23 additions & 14 deletions

File tree

Doc/c-api/typeobj.rst

Lines changed: 9 additions & 8 deletions

Doc/whatsnew/3.11.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ Porting to Python 3.11
214214
(:c:member:`PyTypeObject.tp_traverse`).
215215
(Contributed by Victor Stinner in :issue:`44263`.)
216216

217+
* Heap types with the :const:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit
218+
the :pep:`590` vectorcall protocol. Previously, this was only possible for
219+
:ref:`static types <static-types>`.
220+
(Contributed by Erlend E. Aasland in :issue:`43908`)
221+
217222
Deprecated
218223
----------
219224

Lib/test/test_call.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ def test_method_descriptor_flag(self):
563563
self.assertTrue(_testcapi.MethodDescriptorDerived.__flags__ & Py_TPFLAGS_METHOD_DESCRIPTOR)
564564
self.assertFalse(_testcapi.MethodDescriptorNopGet.__flags__ & Py_TPFLAGS_METHOD_DESCRIPTOR)
565565

566-
# Heap type should not inherit Py_TPFLAGS_METHOD_DESCRIPTOR
566+
# Mutable heap types should not inherit Py_TPFLAGS_METHOD_DESCRIPTOR
567567
class MethodDescriptorHeap(_testcapi.MethodDescriptorBase):
568568
pass
569569
self.assertFalse(MethodDescriptorHeap.__flags__ & Py_TPFLAGS_METHOD_DESCRIPTOR)
@@ -574,7 +574,7 @@ def test_vectorcall_flag(self):
574574
self.assertFalse(_testcapi.MethodDescriptorNopGet.__flags__ & Py_TPFLAGS_HAVE_VECTORCALL)
575575
self.assertTrue(_testcapi.MethodDescriptor2.__flags__ & Py_TPFLAGS_HAVE_VECTORCALL)
576576

577-
# Heap type should not inherit Py_TPFLAGS_HAVE_VECTORCALL
577+
# Mutable heap types should not inherit Py_TPFLAGS_HAVE_VECTORCALL
578578
class MethodDescriptorHeap(_testcapi.MethodDescriptorBase):
579579
pass
580580
self.assertFalse(MethodDescriptorHeap.__flags__ & Py_TPFLAGS_HAVE_VECTORCALL)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Heap types with the :const:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit the
2+
:pep:`590` vectorcall protocol. Previously, this was only possible for
3+
:ref:`static types <static-types>`. Patch by Erlend E. Aasland.

Objects/typeobject.c

Lines changed: 4 additions & 4 deletions

0 commit comments

Comments
 (0)