-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
PEP 820: PySlot: Unified slot system for the C API #4754
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
`Py_slot_invalid` with OPTIONAL can be used as a no-op slot
AA-Turner
left a comment
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.
Couple of columns over 80 chars, could optionally reflow.
A
| change the details. | ||
|
|
||
| Both structures contain a *slots* field – essentially an array of | ||
| `tagged unions <https://en.wikipedia.org/wiki/Tagged_union>`_, |
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.
| `tagged unions <https://en.wikipedia.org/wiki/Tagged_union>`_, | |
| `tagged unions <https://en.wikipedia.org/wiki/Tagged_union>`__, |
| Discussions-To: Pending | ||
| Status: Draft | ||
| Type: Standards Track | ||
| Created: 17-Dec-2025 |
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.
Date of number assignment
| Created: 17-Dec-2025 | |
| Created: 19-Dec-2025 |
| ... | ||
|
|
||
| PyObject *MyClass = PyType_FromSlots(myClass_slots, -1); |
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.
| ... | |
| PyObject *MyClass = PyType_FromSlots(myClass_slots, -1); | |
| // ... | |
| PyObject *MyClass = PyType_FromSlots(myClass_slots, -1); |
| - Non-pointers (``basicsize``, ``flags``). | ||
| Originally, slots were intended to | ||
| only contain *function pointers*; they now contain *data pointers* as well as | ||
| integers or flags. This proposal uses an union to handle types cleanly. |
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.
| integers or flags. This proposal uses an union to handle types cleanly. | |
| integers or flags. This proposal uses a union to handle types cleanly. |
Basic requirements (all PEP Types)
pep-NNNN.rst), PR title (PEP 123: <Title of PEP>) andPEPheaderAuthororSponsor, and formally confirmed their approvalAuthor,Status(Draft),TypeandCreatedheaders filled out correctlyPEP-Delegate,Topic,RequiresandReplacesheaders completed if appropriate.github/CODEOWNERSfor the PEPStandards Track requirements
Python-Versionset to valid (pre-beta) future Python version, if relevantDiscussions-ToandPost-History📚 Documentation preview 📚: https://pep-previews--4754.org.readthedocs.build/