Skip to content

Commit

Permalink
pythongh-103272: regression test for getattr exception in property (p…
Browse files Browse the repository at this point in the history
…ythonGH-103336)

(cherry picked from commit 5d7d86f)

Co-authored-by: sunmy2019 <[email protected]>
  • Loading branch information
sunmy2019 authored and miss-islington committed Apr 7, 2023
1 parent 1b1f016 commit 29824ef
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 29824ef

Please sign in to comment.