bpo-36974: inherit tp_vectorcall_offset unconditionally#13858
bpo-36974: inherit tp_vectorcall_offset unconditionally#13858encukou merged 1 commit intopython:masterfrom
Conversation
|
Does this change support the stable ABI? Is it still possible to use a C extension compiled with Python 3.6 on Python 3.9 with this change? The C extension compiled with Python 3.6 can use static types with Python 3.6 PyTypeObject which doesn't have tp_vectorcall field. My notes on these topics:
I decided to give up on my tp_fastcall slot experiment because of these problems. |
|
Isn't the whole "stable ABI for static types" issue gone since #4944? Regardless of that, |
|
See also https://www.python.org/dev/peps/pep-0580/#using-tp-print (this is in PEP 580 which was rejected but the same applies to PEP 590). |
At the moment, |
Honestly... I have no idea :-( All I know is that PyQt rely on the stable ABI.
For example, if Python 3.6 PyTypeObject is 100 bytes long, but tp_vectorcall offset is 108: setting tp_vectorcall field of a Python 3.6 static type would lead to a buffer overflow causing undefined behavior. I don't know if it's the case. I'm just raising the question. cc @pitrou |
The thing that matters is Your concerns might be valid when we implement vectorcall for the type object itself (i.e. for |
|
Can I please ask again for a review? This is the only open bugfix for PEP 590 (there are many other open tickets regarding PEP 590, but those are enhancements, not bugfixes). |
|
LGTM. @vstinner I'd like to merge this if you have no further objections. |
|
I think the questions were answered. Victor, if you have any more, let me know. |
|
Thanks and don't forget to backport to 3.8 |
I only had questions about the ABI compatibility, but I think that it was discussed in length here and in https://bugs.python.org/issue37250 In short, we don't provide any backward compatibility warranty at the ABI level for static types. If you want a stable ABI, avoid static types and use PyType_FromSpec() instead. |
|
I'm having trouble backporting to |
|
GH-14342 is a backport of this pull request to the 3.8 branch. |
(cherry picked from commit a8b27e6) Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
This fixes one more corner case in vectorcall inheritance. Bugfix, so needs backport to 3.8.
CC @encukou
https://bugs.python.org/issue36974