Skip to content

Commit e3ed574

Browse files
thejcannonAA-TurnerJelleZijlstraerlend-aaslandhugovk
authored
gh-90562: Mention slots pitfall in dataclass docs (#107391)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 10b1bd9 commit e3ed574

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Doc/library/dataclasses.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ Module contents
185185
- *slots*: If true (the default is ``False``), :attr:`~object.__slots__` attribute
186186
will be generated and new class will be returned instead of the original one.
187187
If :attr:`!__slots__` is already defined in the class, then :exc:`TypeError`
188-
is raised.
188+
is raised. Calling no-arg :func:`super` in dataclasses using ``slots=True`` will result in
189+
the following exception being raised:
190+
``TypeError: super(type, obj): obj must be an instance or subtype of type``.
191+
The two-arg :func:`super` is a valid workaround. See :gh:`90562` for full details.
189192

190193
.. versionadded:: 3.10
191194

0 commit comments

Comments
 (0)