Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ddaed62

Browse filesBrowse files
miss-islingtonthejcannonAA-TurnerJelleZijlstraerlend-aasland
authored
[3.12] gh-90562: Mention slots pitfall in dataclass docs (GH-107391) (#119351)
Co-authored-by: Josh Cannon <joshdcannon@gmail.com> 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 0d5fe2c commit ddaed62
Copy full SHA for ddaed62

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed

‎Doc/library/dataclasses.rst

Copy file name to clipboardExpand all lines: Doc/library/dataclasses.rst
+4-1Lines changed: 4 additions & 1 deletion
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.