Skip to content

Commit ddaed62

Browse files
miss-islingtonthejcannonAA-TurnerJelleZijlstraerlend-aasland
authored
[3.12] gh-90562: Mention slots pitfall in dataclass docs (GH-107391) (#119351)
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]>
1 parent 0d5fe2c commit ddaed62

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)