Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions peps/pep-0820.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ PEP: 820
Title: PySlot: Unified slot system for the C API
Author: Petr Viktorin <encukou@gmail.com>
Discussions-To: https://discuss.python.org/t/105552
Status: Draft
Status: Accepted
Type: Standards Track
Created: 19-Dec-2025
Python-Version: 3.15
Post-History: `06-Jan-2026 <https://discuss.python.org/t/105552>`__
Resolution: `23-Apr-2025 <https://discuss.python.org/t/105552/24>`__


.. highlight:: c
Expand Down Expand Up @@ -143,7 +144,7 @@ which can be specified as C literals using macros, like this::

// ...

PyObject *MyClass = PyType_FromSlots(myClass_slots, -1);
PyObject *MyClass = PyType_FromSlots(myClass_slots);

The macros simplify hand-written literals.
For more complex use cases, like compatibility between several Python versions,
Expand Down Expand Up @@ -327,6 +328,8 @@ the same effect.
To allow changing the edge case behaviour in the (far) future,
and to allow freedom for possible alternative implementations of the C API,
we'll start issuing runtime deprecation warnings in these cases.
To avoid flooding users with warnings for things that are outside of their
control, we'll only show deprecation warnings when the new API is used.


Specification
Expand Down Expand Up @@ -483,7 +486,7 @@ Each ``PyType_Slot`` in the array will be converted to
and similar with ``PyModuleDef_Slot``.

In the initial implementation, nesting depth will be limited to 5 levels.
This restrictions may be lifted in the future.
This restriction may be lifted in the future.


New slot IDs
Expand Down Expand Up @@ -585,9 +588,10 @@ This includes nested "new-style" slots (``Py_slot_subslots``).
Deprecation warnings
--------------------

CPython will emit runtime deprecation warnings for the following cases,
for slots where the case is currently disallowed in documentation but allowed
by the runtime:
Functions that take ``PySlot`` arrays (but not functions that take
the older ``PyType_Slot`` or ``PyModuleDef_Slot`` arrays) will emit runtime
deprecation warnings for the following cases, for slots where the case is
currently disallowed in documentation but allowed by the runtime:

- setting a slot value to NULL:

Expand Down Expand Up @@ -739,6 +743,10 @@ for substantial input on this iteration of the proposal.
Change History
==============

* 24-Apr-2026
- Limit deprecation for NULL and repeated slots to the new API.
- PEP is accepted

* `12-Mar-2026 <https://discuss.python.org/t/105552/12>`__
- Remove unnecessary flag ``PySlot_HAS_FALLBACK``

Expand Down
Loading