8000 gh-96663: Add a better error message for __dict__-less classes setattr by Gobot1234 · Pull Request #103232 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-96663: Add a better error message for __dict__-less classes setattr #103232

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

Merged
merged 11 commits into from
Jul 22, 2023
Prev Previous commit
Next Next commit
Fix formatting nits
  • Loading branch information
Gobot1234 committed Apr 4, 2023
commit cb1810fcda216dad3db9cb54e4bd109ba7e0c3a7
4 changes: 2 additions & 2 deletions Lib/test/test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,15 +640,15 @@ class A:
pass
class B:
y = 0
__slots__ = ('z', "foo")
__slots__ = ('z', 'foo')

error_msg = "'A' object has no attribute 'x'"
with self.assertRaisesRegex(AttributeError, error_msg):
A().x
with self.assertRaisesRegex(AttributeError, error_msg):
del A().x

error_msg = ("'B' object has no attribute 'x'")
error_msg = "'B' object has no attribute 'x'"
with self.assertRaisesRegex(AttributeError, error_msg):
B().x
with self.assertRaisesRegex(AttributeError, error_msg):
Expand Down
0