-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-90562: Mention slots pitfall in dataclass docs #107391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
e40f5f9
e9930d7
91bbbd2
08903c5
fdff6b5
dde52b3
173d4b1
e6b3669
42606c3
c4cb9ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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:`~object.__slots__` is already defined in the class, then :exc:`TypeError` | ||
is raised. | ||
is raised. Calling no-arg ``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 ``super()`` is a valid workaround. See :issue:`46404` for full details. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should try to capture everything relevant in the documentation -- what is relevant to the reader from the linked issue that isn't captured in your summary? A There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 6F6BI think these two points are it. What to look for and how to workaround.
thejcannon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. versionadded:: 3.10 | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.