Skip to content

Commit 9c61718

Browse files
kwspFidget-Spinner
authored andcommitted
pythongh-100315: clarification to __slots__ docs. (python#102621)
refer to tp_itemsize in discussion on "variable-length" built-in types
1 parent 4d7f5d0 commit 9c61718

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Doc/reference/datamodel.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -1944,8 +1944,10 @@ Notes on using *__slots__*
19441944
descriptor directly from the base class). This renders the meaning of the
19451945
program undefined. In the future, a check may be added to prevent this.
19461946

1947-
* Nonempty *__slots__* does not work for classes derived from "variable-length"
1948-
built-in types such as :class:`int`, :class:`bytes` and :class:`tuple`.
1947+
* :exc:`TypeError` will be raised if nonempty *__slots__* are defined for a
1948+
class derived from a
1949+
:c:member:`"variable-length" built-in type <PyTypeObject.tp_itemsize>` such as
1950+
:class:`int`, :class:`bytes`, and :class:`tuple`.
19491951

19501952
* Any non-string :term:`iterable` may be assigned to *__slots__*.
19511953

0 commit comments

Comments
 (0)