Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

gh-74929: Fix an extra DECREF for PEP 667 implementation#118583

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

gaogaotiantian
Copy link
Member

@gaogaotiantiangaogaotiantian commentedMay 5, 2024
edited by bedevere-appbot
Loading

In the PEP 667 implementation, when I copied the code from_PyFrame_LocalsToFast, I did not realize thevalue is a new reference so it was decrefed in the original code. This resulted in an extra DECREF in__setitem__. Unfortunately I did not catch it because the test cases used were all immortals.

Two test cases were added:

  • local object variable - this will trigger an assertion failure in debug mode
  • f_locals updating itself multiple times - this will crash the interpreter without the fix

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

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

Maybe you want to delete or update the comment in the test?

self.assertEqual(o, 'a.b.c')

def test_update_with_self(self):
# Make sure reference is not leaking here
Copy link
Member

Choose a reason for hiding this comment

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

The problem was not a leak though -- it was a free-after-use (the opposite of a leak, really :-).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Right. I was imaging a pool of reference and a hole that's leaking the reference without people knowing it so the pool is drained, but yeah leak is not a good word choice here. I just deleted it, the test itself makes sense without any comments.

Copy link
Member

Choose a reason for hiding this comment

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

Ooh, that's actually a nice image. :-) I will merge now.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Thanks for the quick review!

@gvanrossumgvanrossumenabled auto-merge (squash)May 5, 2024 02:53
@gvanrossumgvanrossum merged commit5dd3673 intopython:mainMay 5, 2024
@gaogaotiantiangaogaotiantian deleted the fix-framelocalsproxy-setitem branchMay 5, 2024 03:36
SonicField pushed a commit to SonicField/cpython that referenced this pull requestMay 8, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gvanrossumgvanrossumgvanrossum approved these changes

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@gaogaotiantian@gvanrossum

[8]ページ先頭

©2009-2025 Movatter.jp