Skip to content

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

Merged
hauntsaninja merged 6 commits into
python:mainfrom
sunmy2019:test-case-for-gh-103272
Apr 7, 2023
Merged

gh-103272: add regression test for getattr that raises#103336
hauntsaninja merged 6 commits into
python:mainfrom
sunmy2019:test-case-for-gh-103272

Conversation

@sunmy2019

Copy link
Copy Markdown
Member

Add test case taken from gh-103272 for #103332.

@bedevere-botbedevere-bot added the tests Tests in the Lib/test dir label Apr 7, 2023
@bedevere-bot

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@hauntsaninjahauntsaninja left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, thanks for narrowing this down!

I think we can make the test case slightly simpler to make it clearer what's getting tested:

class A:
def __getattr__(self, name):
raise ValueError
@property
def foo(self):
return self.__getattr__("asdf")
A().foo

And maybe rename the test to test_getattr_raises or something

@hauntsaninjahauntsaninja changed the title add test case for gh-103272gh-103272: add regression testApr 7, 2023
@hauntsaninjahauntsaninja changed the title gh-103272: add regression testgh-103272: add regression test for getattr that raisesApr 7, 2023
@sobolevn

Copy link
Copy Markdown
Member

I've got the revert merged, now this test must pass :)

@sobolevnsobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment threadLib/test/test_descr.py Outdated
Comment threadMisc/NEWS.d/next/Tests/2023-04-07-07-56-39.gh-issue-103272.QosA_L.rst Outdated
Comment threadLib/test/test_descr.py Outdated

@sobolevnsobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on your first CPython PR 🎉

@hauntsaninjahauntsaninja left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again, this is great!

@hauntsaninjahauntsaninja added the needs backport to 3.11 only security fixes label Apr 7, 2023
@hauntsaninja
hauntsaninja merged commit 5d7d86f into python:mainApr 7, 2023
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @sunmy2019 for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 7, 2023
…ythonGH-103336)
(cherry picked from commit 5d7d86f)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
@bedevere-bot

Copy link
Copy Markdown

GH-103351 is a backport of this pull request to the 3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11 only security fixes label Apr 7, 2023
miss-islington added a commit that referenced this pull request Apr 7, 2023
(cherry picked from commit 5d7d86f)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
@sunmy2019
sunmy2019 deleted the test-case-for-gh-103272 branch May 10, 2023 14:01
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@sunmy2019@bedevere-bot@sobolevn@miss-islington@hauntsaninja@arhadthedev