aboutsummaryrefslogtreecommitdiff
path: root/Doc/reference
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-03-14 02:32:09 -0700
committerGitHub <noreply@github.com>2023-03-14 02:32:09 -0700
commit1f7eb8fe6c1a566caf934a96c6fe2877b2447d5b (patch)
treeb561dc0af7e764f6b4f46f9c300e1da3d41ea9ab /Doc/reference
parent0f46d42eb9fed0f11ec68e8782a3cbcb891d7ba0 (diff)
downloadcpython3-1f7eb8fe6c1a566caf934a96c6fe2877b2447d5b.tar.gz
gh-100315: clarification to `__slots__` docs. (GH-102621)
refer to tp_itemsize in discussion on "variable-length" built-in types (cherry picked from commit 88c262c086077377b40dfae5e46f597e28ffe3c9) Co-authored-by: T <tnie@tuta.io>
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/datamodel.rst6
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index e94b535901..87c538f6f2 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1944,8 +1944,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__*.