Skip to content

Commit

Permalink
pythongh-90562: Mention slots pitfall in dataclass docs (pythonGH-107391
Browse files Browse the repository at this point in the history
)

(cherry picked from commit e3ed574)

Co-authored-by: Josh Cannon <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Erlend E. Aasland <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
5 people authored and miss-islington committed May 21, 2024
1 parent 256b791 commit 2580775
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ Module contents
- *slots*: If true (the default is ``False``), :attr:`~object.__slots__` attribute
will be generated and new class will be returned instead of the original one.
If :attr:`!__slots__` is already defined in the class, then :exc:`TypeError`
is raised.
is raised. Calling no-arg :func:`super` in dataclasses using ``slots=True`` will result in
the following exception being raised:
``TypeError: super(type, obj): obj must be an instance or subtype of type``.
The two-arg :func:`super` is a valid workaround. See :gh:`90562` for full details.

.. versionadded:: 3.10

Expand Down

0 comments on commit 2580775

Please sign in to comment.