-
Notifications
You must be signed in to change notification settings - Fork 792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avoid calling PyType_GetSlot
on static types before Python 3.10
#4599
Conversation
cc @alex as a consumer of abi3, is this workaround acceptable to you? |
Hmm, so the basic assumption here is that it's ok to hardcode some structs (that are not ABI3) because we're only doing it for old versions, and obviously those old versions can't change retroactively? |
Yes, with a check at runtime to be sure we aren't doing this on newer python versions. |
I guess that's probably fine. Annoying that a) it had this limitation,
b) I never noticed when I did the original impl here.
…On Fri, Oct 4, 2024 at 12:05 PM David Hewitt ***@***.***> wrote:
Yes, with a check at runtime to be sure we aren't doing this on newer python versions.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
--
All that is necessary for evil to succeed is for good people to do nothing.
|
I think for the original uses you implemented, it was only called for our heap types. But it was tempting enough for me to copy the same pattern and use it on arbitrary types... kaboom 🤣 |
It sounds like we're okay with moving ahead with this, so I will merge it and add it to the 0.22.4 release backports so that I can also resolve #4563. |
Yeah, I'm ok moving forward (sad, but ok.)
…On Mon, Oct 7, 2024 at 4:32 PM David Hewitt ***@***.***> wrote:
#4599 <#4599> was added to the merge
queue <https://github.com/PyO3/pyo3/queue/main>.
—
Reply to this email directly, view it on GitHub
<#4599 (comment)>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAGBBEVITGHWV6JMQ4M3TZ2LVUTAVCNFSM6AAAAABPMHT7FCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJUGU2DMNBZGQ4DGMQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
All that is necessary for evil to succeed is for good people to do nothing.
|
Yes, hurry up 3.9 EOL. 😂 |
Split from #4563
I ran into a crash trying to merge that PR because I ended up calling
PyType_GetSlot
on a static type, which isn't legal before Python 3.10.This led to a problem... what to do about abi3 on Python 3.7 through 3.9, where we do occasionally need to look up slot in type objects, but the "good" way of using
PyType_GetSlot
may cause crashes. ThePyTypeObject
definition is also deliberately not available in the limited API.The only practical workaround I could think of is to inline the
PyTypeObject
definition (as of 3.9) into a helper function.get_slot(SLOT_NAME)
, which tries to do the right thing in each of the three cases:PyType_GetSlot