-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Use PyType_Spec to define types instead of PyTypeObject. #187
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing this. Given the size of the diff, I'm not sure when I'll get around to reviewing this. But it is a patch I'm tentatively interested in taking.
Regarding adoption of the stable ABI, I'm not opposed. But I thought we made use of unstable APIs (like maybe _PyBytes_Resize()
?). Some of these might be necessary to achieve peak performance.
But out of principle I support converging onto the stable ABI where it doesn't introduce performance or other usability drawbacks.
Would it help if I split this change in pieces, one per type? The only two things that (besides Py_buffer, which is in the stable API since 3.11) are not in the stable API are _PyBytes_Resize and Py_SET_SIZE. When I looked superficially, it seemed it might be possible to switch to bytearrays. |
Yes.
In theory we could switch to I also recall there being issues in older versions of Python where |
…ionChunkerIterator
…thSegmentsCollection
I'm going to ship the next release with zstd 1.5.4 to get that out the door. Then I'm going to drop Python 3.6 support. Then I'll look at this PR. And possibly start chipping at moving to the stable API so we can ship fewer wheels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cherry picked all these commits locally. Although I applied them out-of-order because I deferred the tp_buffer
and version sniffing changes to the end because they were special and I didn't understand what was going on at first.
I do wonder why CPython didn't stabilize these at the same time as all the other slots. 🤷♂️
Will push to main
once branch CI passes.
Thanks for this refactor! Greatly simplifies the definition of the C types!
This is a first step towards possibly using the stable ABI.