Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.10] gh-100315: clarification to __slots__ docs. (GH-102621) #102688

Merged
merged 1 commit into from
Mar 14, 2023
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
6 changes: 4 additions & 2 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1876,8 +1876,10 @@ Notes on using *__slots__*
descriptor directly from the base class). This renders the meaning of the
program undefined. In the future, a check may be added to prevent this.

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

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

Expand Down