GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-103272: add regression test for getattr that raises by sunmy2019 · Pull Request #103336 · python/cpython

Conversation

@sunmy2019

@sunmy2019 sunmy2019 commented Apr 7, 2023

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sunmy2019
add test case for pythongh-103272
d1f461f
@bedevere-bot bedevere-bot added the tests Tests in the Lib/test dir label Apr 7, 2023
@bedevere-bot

bedevere-bot commented Apr 7, 2023

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot mentioned this pull request Apr 7, 2023
Maximum recursion depth exceeded in __getattr__(). #103272
Closed
@bedevere-bot bedevere-bot added the awaiting review label Apr 7, 2023
hauntsaninja
hauntsaninja reviewed Apr 7, 2023
View reviewed changes

@hauntsaninja hauntsaninja left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sunmy2019 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@hauntsaninja hauntsaninja changed the title add test case for gh-103272 gh-103272: add regression test Apr 7, 2023
@sunmy2019
add news
59ff49a
@hauntsaninja hauntsaninja changed the title gh-103272: add regression test gh-103272: add regression test for getattr that raises Apr 7, 2023
@sobolevn
Merge branch 'main' into test-case-for-pythongh-103272
21f7ec7
@sobolevn

sobolevn commented Apr 7, 2023

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sobolevn
sobolevn reviewed Apr 7, 2023
View reviewed changes

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thank you!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_descr.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Misc/NEWS.d/next/Tests/2023-04-07-07-56-39.gh-issue-103272.QosA_L.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev arhadthedev added the skip news label Apr 7, 2023
sunmy2019 added 2 commits April 7, 2023 09:49
@sunmy2019
simplify test case, remove NEWS
d9e7600
@sunmy2019
nit: remove extra line
7f28066
sobolevn
sobolevn reviewed Apr 7, 2023
View reviewed changes
Comment thread Lib/test/test_descr.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sunmy2019
use assertRaisesRegex instead of assertRaises
938dca9
sobolevn
sobolevn approved these changes Apr 7, 2023
View reviewed changes

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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 🎉

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Apr 7, 2023
hauntsaninja
hauntsaninja approved these changes Apr 7, 2023
View reviewed changes

@hauntsaninja hauntsaninja left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Apr 7, 2023
@hauntsaninja hauntsaninja added the needs backport to 3.11 only security fixes label Apr 7, 2023
@hauntsaninja
hauntsaninja merged commit 5d7d86f into python:main Apr 7, 2023
@miss-islington

miss-islington commented Apr 7, 2023

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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting merge label Apr 7, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 7, 2023
@sunmy2019 @miss-islington
pythongh-103272: regression test for getattr exception in property (p…
29824ef
…ythonGH-103336)

(cherry picked from commit 5d7d86f)

Co-authored-by: sunmy2019 <[email protected]>
@bedevere-bot

bedevere-bot commented Apr 7, 2023

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-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
@miss-islington @sunmy2019
gh-103272: regression test for getattr exception in property (GH-103336)
b8d1623
(cherry picked from commit 5d7d86f)

Co-authored-by: sunmy2019 <[email protected]>
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
@sunmy2019 @warsaw
pythongh-103272: regression test for getattr exception in property (p…
a82048a
…ython#103336)
@AlexWaygood AlexWaygood mentioned this pull request Apr 14, 2023
[3.12] Behavior change: __getattr__ gets called after property raises NotImplementedError #103551
Closed
@sunmy2019 sunmy2019 mentioned this pull request Apr 25, 2023
gh-102213: Optimize the performance of __getattr__ #103761
Merged
@sunmy2019
sunmy2019 deleted the test-case-for-gh-103272 branch May 10, 2023 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sobolevn sobolevn sobolevn approved these changes
@hauntsaninja hauntsaninja hauntsaninja approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@sunmy2019 @bedevere-bot @sobolevn @miss-islington @hauntsaninja @arhadthedev
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.