Skip to content
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

gh-127190: Fix local_setattro() error handling #127366

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 28, 2024

Don't make the assumption that the 'name' argument is a string. Use repr() to format the 'name' argument instead.

Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
@vstinner
Copy link
Member Author

cc @ZeroIntensity @sobolevn

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

The fix and test both look fine, but how come we're skipping a blurb entry?

@vstinner
Copy link
Member Author

The fix and test both look fine, but how come we're skipping a blurb entry?

I don't think that regular users pass objects with a compare function which always compare to true. If you use setattr(), the "lying" object is rejected (no bug). So I don't think that it's useful to document this change for end users.

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thank you!

@vstinner vstinner merged commit 20657fb into python:main Nov 28, 2024
51 checks passed
@vstinner vstinner deleted the local_setattro branch November 28, 2024 16:35
@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 28, 2024
Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
(cherry picked from commit 20657fb)

Co-authored-by: Victor Stinner <vstinner@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 28, 2024
Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
(cherry picked from commit 20657fb)

Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Nov 28, 2024

GH-127367 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Nov 28, 2024
@bedevere-app
Copy link

bedevere-app bot commented Nov 28, 2024

GH-127368 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Nov 28, 2024
vstinner added a commit that referenced this pull request Nov 28, 2024
…27368)

gh-127190: Fix local_setattro() error handling (GH-127366)

Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
(cherry picked from commit 20657fb)

Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot x86-64 macOS 3.12 has failed when building commit 7d175ca.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1185/builds/1090) and take a look at the build logs.
  4. Check if the failure is related to this commit (7d175ca) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1185/builds/1090

Failed tests:

  • test.test_multiprocessing_spawn.test_processes

Failed subtests:

  • test_repr_rlock - test.test_multiprocessing_spawn.test_processes.WithProcessesTestLock.test_repr_rlock

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.12.billenstein-macos/build/Lib/test/_test_multiprocessing.py", line 1479, in test_repr_rlock
    self.assertEqual('<RLock(SomeOtherThread, nonzero)>', repr(lock))
AssertionError: '<RLock(SomeOtherThread, nonzero)>' != '<RLock(None, 0)>'
- <RLock(SomeOtherThread, nonzero)>
+ <RLock(None, 0)>

@ZeroIntensity
Copy link
Member

I don't think that's related.

vstinner added a commit that referenced this pull request Dec 1, 2024
…27367)

gh-127190: Fix local_setattro() error handling (GH-127366)

Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
(cherry picked from commit 20657fb)

Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants