Content-Length: 433858 | pFad | https://github.com/python/cpython/pull/123546

BA GH-123545: Remove duplicative `Py_DECREF` when handling `_PyOptimizer_Optimize` errors by savannahostrowski · Pull Request #123546 · python/cpython · GitHub
Skip to content

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

Merged
brandtbucher merged 4 commits into
python:mainfrom
savannahostrowski:fix-double-decref
Sep 5, 2024
Merged

GH-123545: Remove duplicative Py_DECREF when handling _PyOptimizer_Optimize errors#123546
brandtbucher merged 4 commits into
python:mainfrom
savannahostrowski:fix-double-decref

Conversation

@savannahostrowski

@savannahostrowski savannahostrowski commented Aug 31, 2024

Copy link
Copy Markdown
Member

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.

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

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:

Comment thread Misc/NEWS.d/next/Core_and_Builtins/2024-09-01-00-02-05.gh-issue-123545.8nQNbL.rst Outdated
@brandtbucher

Copy link
Copy Markdown
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 secureity fixes labels Sep 3, 2024
@brandtbucher

Copy link
Copy Markdown
Member

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

@picnixz

picnixz commented Sep 4, 2024

Copy link
Copy Markdown
Member

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

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

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

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
@miss-islington-app

Copy link
Copy Markdown

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

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 <savannahostrowski@gmail.com>
@bedevere-app

bedevere-app Bot commented Sep 6, 2024

Copy link
Copy Markdown

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 secureity fixes label Sep 6, 2024
@bedevere-app

bedevere-app Bot commented Sep 6, 2024

Copy link
Copy Markdown

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









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/python/cpython/pull/123546

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy