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 messag 8000 e 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 typo
Co-authored-by: Crowthebird <78076854+thatbirdguythatuknownot@users.noreply.github.com>
  • Loading branch information
Gobot1234 and thatbirdguythatuknownot committed Apr 5, 2023
commit 8642463d3060ae871bf5a36d92d97659a4c0231b
3 changes: 2 additions & 1 deletion Lib/test/test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import unittest


testmeths = [

# Binary operations
Expand Down Expand Up @@ -669,7 +670,7 @@ def __setattr__(self, name, value) -> None:
AttributeError,
"'C' object has no attribute 'x'"
):
B().x = 0
C().x = 0

error_msg = "'B' object attribute 'y' is read-only"
with self.assertRaisesRegex(AttributeError, error_msg):
Expand Down
0