GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-104584: Fix error handling from backedge optimization by gvanrossum · Pull Request #106484 · python/cpython

Conversation

@gvanrossum

@gvanrossum gvanrossum commented Jul 6, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

When _PyOptimizer_BackEdge returns NULL, we should restore next_instr (and stack_pointer). To accomplish this we should jump to resume_with_error instead of just error.

The problem this causes is subtle -- the only repro I have is in PR gh-106393, at commit d7df54b. But the fix is real (as shown there).

While we're at it, also improve the debug output: the offsets at which traces are identified are now measured in bytes, and always show the start offset. This makes it easier to correlate executor calls with optimizer calls, and either with dis output.

  • Issue: Pluggable optimizer API #104584

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gvanrossum added 2 commits July 6, 2023 07:30
@gvanrossum
On _PyOptimizer_BackEdge fail, use resume logic
a57ca7a
This fixes a nasty bug in exception handling.
Apparently some part of the computation that determines
where the exception handler is uses next_instr,
which was pointing at the JUMP_BACKWARD instruction instead of
where the error was occurring.

Better fix for _PyOptimizer_BackEdge error handling
@gvanrossum
Improve offsets in debug output
9a911cb
Offsets in debug output identifying the start of the trace
are now measured in bytes (and the text shows it).
@gvanrossum
gvanrossum requested a review from markshannon as a code owner July 6, 2023 15:21
@bedevere-bot bedevere-bot added the awaiting core review label Jul 6, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jul 6, 2023
Pluggable optimizer API #104584
Closed
markshannon
markshannon reviewed Jul 6, 2023
View reviewed changes

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

One minor issue, otherwise LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/optimizer.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gvanrossum
Prevent warnings
94d567b
@gvanrossum
gvanrossum enabled auto-merge (squash) July 6, 2023 17:48
@gvanrossum gvanrossum added the skip news label Jul 6, 2023
@gvanrossum
gvanrossum merged commit 003ba71 into python:main Jul 6, 2023
@bedevere-bot bedevere-bot removed the awaiting core review label Jul 6, 2023
@gvanrossum
gvanrossum deleted the fix-backedge branch July 6, 2023 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon markshannon left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@gvanrossum @markshannon @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.