Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-103272: add regression test for getattr that raises #103336

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 6 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions 21 Lib/test/test_descr.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
xxsubtype = None



class OperatorsTest(unittest.TestCase):

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -5003,6 +5004,26 @@ class Child(Parent):
gc.collect()
self.assertEqual(Parent.__subclasses__(), [])

def test_getattribute(self):
# add test case for gh-103272
class A:
def __init__(self) -> None:
self.bar = 0

def __getattribute__(self, name):
sunmy2019 marked this conversation as resolved.
Show resolved Hide resolved
return super().__getattribute__(name)

def __getattr__(self, name):
if self.bar == 0:
raise ValueError

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

with self.assertRaises(ValueError):
A().foo


class DictProxyTests(unittest.TestCase):
def setUp(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add test case for regressions caused by gh-102213.
sunmy2019 marked this conversation as resolved.
Show resolved Hide resolved
Morty Proxy This is a proxified and sanitized view of the page, visit original site.