-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
dataclass.__eq__ no longer errors on missing attributes in Python 3.13 #134488
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
Comments
I'm not sure there's anything we can do at this point. |
A note in the 3.13 What's New would be helpful. For context, I discovered this when debugging behavior differences in async library internals between 3.12 and 3.13. A dataclass with deleted attributes was stored in a contextvar: |
I watched your code and I think I fix your bug.
o1 = Test() o1.del_a() print(o1 == o1) |
FWIW no error is raised if >>> s = [o1]
>>> s == s
True |
And given that other tools like Closing for now. If this proves problematic in practice, we can reopen. |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
Description
Equality with self now returns True in 3.13 for dataclasses with deleted attributes. Previously, this would raise an exception.
This may be related to changes discussed in #128294. However, unlike
other reports (#120645, #116647) where something that was True in 3.12 is now False or an Exception,
this issue is the inverse. In 3.13, the equality test silently returns True when previously it would raise.
This class is badly behaved, it should probably still raise an error.
Test Case
CPython versions tested on:
3.13, 3.12
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: