gh-103272: regression test for getattr exception in property (GH-103336)

(cherry picked from commit 5d7d86f2fd)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2023-04-07 12:36:10 -07:00 committed by GitHub
parent 1b1f0164cb
commit b8d1623f73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4999,6 +4999,19 @@ order (MRO) for bases """
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):