GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — gh-90562: Mention slots pitfall in dataclass docs by thejcannon · Pull Request #107391 · python/cpython Conversation
|
|
I can't say I've seen something like this documented before. I'd like to get some more opinions on it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yeah. If the exception was more clear, maybe it wouldn't be warranted. But it took me longer than I want to admit to put two-and-two together. And then, because I'm super nosy I was able to find the linked issue. So I feel for the little guy who has to piece it all together. (Speaking of, I should edit to suggest the workaround, the "old-style" super call) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 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.
The 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think these two points are it. What to look for and how to workaround.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I feel like early in my CPython contribution I remember someone saying "we don't document bugs, we fix them." But I'm also sympathetic to the point of view that this is a significant limitation that people are likely to hit and with an extremely confusing symptom, and there's no clear fix for it on the horizon, and it would be kinder to our users to surface it in the docs. So while it bugs me slightly, on the whole I think I'm in favor of this. I'll leave the final say to our documentation experts (and @ericvsmith as dataclasses expert.) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This seems sensible to me. It took me a while to find out what was going on when I encountered this issue.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Adam Turner <[email protected]>
There was an error while loading. Please reload this page.
Co-authored-by: Jelle Zijlstra <[email protected]>
|
(This now has a merge conflict.) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks @thejcannon for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
) (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]>
) (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]>
|
GH-119350 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-119351 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Huzzah! 🎉 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…119350) 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]>
…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]>
|
Could you backport this also to the 3.10 docs? I ran into the issue, and since I need to use 3.10 atm I read the 3.10 docs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, 3.10 and 3.11 are only allowed to have security fixes: https://devguide.python.org/versions/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.