8000 gh-100315: clarification to `__slots__` docs. (GH-102621) · python/cpython@2c015a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2c015a6

Browse files
miss-islingtonkwsp
andauthored
gh-100315: clarification to __slots__ docs. (GH-102621)
refer to tp_itemsize in discussion on "variable-length" built-in types (cherry picked from commit 88c262c) Co-authored-by: T <tnie@tuta.io>
1 parent 125f75c commit 2c015a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Doc/reference/datamodel.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,8 +1876,10 @@ Notes on using *__slots__*
18761876
descriptor directly from the base class). This renders the meaning of the
18771877
program undefined. In the future, a check may be added to prevent this.
18781878

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

18821884
* Any non-string :term:`iterable` may be assigned to *__slots__*.
18831885

0 commit comments

Comments
 (0)
0