Skip to content

Commit

Permalink
gh-103272: regression test for getattr exception in property (#103336)
Browse files Browse the repository at this point in the history
sunmy2019 authored Apr 7, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent a90863c commit 5d7d86f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Lib/test/test_descr.py
Original file line number Diff line number Diff line change
@@ -5003,6 +5003,19 @@ class Child(Parent):
gc.collect()
self.assertEqual(Parent.__subclasses__(), [])

def test_attr_raise_through_property(self):
# add test case for gh-103272
class A:
def __getattr__(self, name):
raise ValueError("FOO")

@property
def foo(self):
return self.__getattr__("asdf")

with self.assertRaisesRegex(ValueError, "FOO"):
A().foo


class DictProxyTests(unittest.TestCase):
def setUp(self):

0 comments on commit 5d7d86f

Please sign in to comment.