Skip to content

Commit

Permalink
gh-103272: regression test for getattr exception in property (GH-103336)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5d7d86f)

Co-authored-by: sunmy2019 <[email protected]>
  • Loading branch information
miss-islington and sunmy2019 authored Apr 7, 2023
1 parent 1b1f016 commit b8d1623
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
Expand Up @@ -4999,6 +4999,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):
Expand Down

0 comments on commit b8d1623

Please sign in to comment.