Skip to content

Commit d9c120f

Browse files
authored
PEP 820: Mark Accepted (GH-4939)
- Mark Accepted - Limit deprecation warnings to new API, per SC request - Fix code example & typo
1 parent 0b2298a commit d9c120f

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

peps/pep-0820.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ PEP: 820
22
Title: PySlot: Unified slot system for the C API
33
Author: Petr Viktorin <encukou@gmail.com>
44
Discussions-To: https://discuss.python.org/t/105552
5-
Status: Draft
5+
Status: Accepted
66
Type: Standards Track
77
Created: 19-Dec-2025
88
Python-Version: 3.15
99
Post-History: `06-Jan-2026 <https://discuss.python.org/t/105552>`__
10+
Resolution: `23-Apr-2025 <https://discuss.python.org/t/105552/24>`__
1011

1112

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

144145
// ...
145146

146-
PyObject *MyClass = PyType_FromSlots(myClass_slots, -1);
147+
PyObject *MyClass = PyType_FromSlots(myClass_slots);
147148

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

331334

332335
Specification
@@ -483,7 +486,7 @@ Each ``PyType_Slot`` in the array will be converted to
483486
and similar with ``PyModuleDef_Slot``.
484487

485488
In the initial implementation, nesting depth will be limited to 5 levels.
486-
This restrictions may be lifted in the future.
489+
This restriction may be lifted in the future.
487490

488491

489492
New slot IDs
@@ -585,9 +588,10 @@ This includes nested "new-style" slots (``Py_slot_subslots``).
585588
Deprecation warnings
586589
--------------------
587590

588-
CPython will emit runtime deprecation warnings for the following cases,
589-
for slots where the case is currently disallowed in documentation but allowed
590-
by the runtime:
591+
Functions that take ``PySlot`` arrays (but not functions that take
592+
the older ``PyType_Slot`` or ``PyModuleDef_Slot`` arrays) will emit runtime
593+
deprecation warnings for the following cases, for slots where the case is
594+
currently disallowed in documentation but allowed by the runtime:
591595

592596
- setting a slot value to NULL:
593597

@@ -739,6 +743,10 @@ for substantial input on this iteration of the proposal.
739743
Change History
740744
==============
741745

746+
* 24-Apr-2026
747+
- Limit deprecation for NULL and repeated slots to the new API.
748+
- PEP is accepted
749+
742750
* `12-Mar-2026 <https://discuss.python.org/t/105552/12>`__
743751
- Remove unnecessary flag ``PySlot_HAS_FALLBACK``
744752

0 commit comments

Comments
 (0)