Skip to content

Commit 5846379

Browse files
Apply suggestions from code review
Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent 723dcaa commit 5846379

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/reference/datamodel.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,9 +2632,10 @@ Notes on using *__slots__*:
26322632

26332633
* :exc:`TypeError` will be raised if *__slots__* other than *__dict__* and
26342634
*__weakref__* are defined for a class derived from a
2635-
:c:member:`"variable-length" built-in type <PyTypeObject.tp_itemsize>`
2636-
without the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag such as
2637-
:class:`int`, :class:`bytes`, and :class:`tuple`.
2635+
:c:member:`"variable-length" built-in type <PyTypeObject.tp_itemsize>`,
2636+
unless the C type is defined with :c:macro:`Py_TPFLAGS_ITEMS_AT_END`.
2637+
For example, *__slots__* other than *__dict__* and *__weakref__* cannot
2638+
be defined on subclasses of :class:`int`, :class:`bytes`, or :class:`tuple`.
26382639

26392640
* Any non-string :term:`iterable` may be assigned to *__slots__*.
26402641

@@ -2659,7 +2660,6 @@ Notes on using *__slots__*:
26592660

26602661
.. versionchanged:: next
26612662
Allowed defining the *__dict__* and *__weakref__* *__slots__* for any class.
2662-
26632663
Allowed defining any *__slots__* for a class derived from :class:`type` or
26642664
other :c:member:`"variable-length" built-in type <PyTypeObject.tp_itemsize>`
26652665
with the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag.

0 commit comments

Comments
 (0)