Skip to content

GH-123545: Remove duplicative Py_DECREF when handling _PyOptimizer_Optimize errors #123546

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

Merged
merged 4 commits into from
Sep 5, 2024

Conversation

savannahostrowski
Copy link
Member

@savannahostrowski savannahostrowski commented Aug 31, 2024

This PR removes duplicative Py_DECREF calls when _PyOptimizer_Optimize returns -1. In both cases, we do so in the conditional block and then as part of the GOTO_UNWIND macro. This never really happens in practice, but it would be problematic if this error'd.

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

Yep, it looks like this is taken care of in error_tier_two (where GOTO_UNWIND() jumps). Just one suggestion for rewording the NEWS entry:

@brandtbucher
Copy link
Member

This will probably require a manual backport, unfortunately.

@brandtbucher brandtbucher added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) needs backport to 3.13 bugs and security fixes labels Sep 3, 2024
@brandtbucher
Copy link
Member

Also, the test failures are weird, but look unrelated.

@picnixz
Copy link
Member

picnixz commented Sep 4, 2024

Also, the test failures are weird, but look unrelated.

They are unrelated. They are caused by some weird glibc stuff so don't worry!

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

The automatic backport will probably fail, but the bot should give you instructions for how to do it manually. Let me know if you need help. I think only _DYNAMIC_EXIT needs to be updated for 3.13, since _EXIT_TRACE works differently on that branch.

@brandtbucher brandtbucher merged commit 1fbc118 into python:main Sep 5, 2024
53 of 57 checks passed
@miss-islington-app
Copy link

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

@miss-islington-app
Copy link

Sorry, @savannahostrowski and @brandtbucher, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 1fbc118c5d3916e920a57cda3cb6d9a0292de26e 3.13

savannahostrowski added a commit to savannahostrowski/cpython that referenced this pull request Sep 6, 2024
…ptimizer_Optimize errors (pythonGH-123546)

(cherry picked from commit 1fbc118)

Co-authored-by: Savannah Ostrowski <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Sep 6, 2024

GH-123759 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 Sep 6, 2024
@bedevere-app
Copy link

bedevere-app bot commented Sep 6, 2024

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

@savannahostrowski savannahostrowski deleted the fix-double-decref branch September 27, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants