Skip to content

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

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:local_setattro
Nov 28, 2024
Merged

gh-127190: Fix local_setattro() error handling#127366
vstinner merged 1 commit into
python:mainfrom
vstinner:local_setattro

Conversation

@vstinner

@vstinner vstinner commented Nov 28, 2024

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

cc @ZeroIntensity @sobolevn

@ZeroIntensity ZeroIntensity 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.

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

@vstinner

Copy link
Copy Markdown
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.

@ZeroIntensity ZeroIntensity 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.

LGTM

@sobolevn sobolevn 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!

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

Copy link
Copy Markdown

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

bedevere-app Bot commented Nov 28, 2024

Copy link
Copy Markdown

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

bedevere-app Bot commented Nov 28, 2024

Copy link
Copy Markdown

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 only 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
Copy Markdown

⚠️⚠️⚠️ 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
Copy Markdown
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>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
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