Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
gh-90562: Mention slots pitfall in dataclass docs (GH-107391)
(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
commit 823328c8ab19cb6b781921049abcd1cb706d1a36
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