Skip to content

gh-107901: Fix missing line number on BACKWARD_JUMP at the end of a for loop - #108242

Merged
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:gh-107901
Aug 21, 2023
Merged

gh-107901: Fix missing line number on BACKWARD_JUMP at the end of a for loop#108242
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:gh-107901

Conversation

@iritkatriel

@iritkatrieliritkatriel commented Aug 21, 2023

Copy link
Copy Markdown
Member

@iritkatrieliritkatriel added type-bug An unexpected behavior, bug, or error 3.11 only security fixes 3.12 only security fixes 3.13 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Aug 21, 2023

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

I'm not sure how to fix the other lineless instructions you mention, but I think this is a nice simple solution for this case.

@iritkatrieliritkatriel changed the title gh-107901: Fix missing line number on :opcode:BACKWARD_JUMP at the end of a for loopgh-107901: Fix missing line number on BACKWARD_JUMP at the end of a for loopAug 21, 2023
@iritkatriel
iritkatriel merged commit a1cc74c into python:mainAug 21, 2023
@iritkatrieliritkatriel added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Aug 22, 2023
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @iritkatriel, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker a1cc74c4eebc55795877eb3be019a1bec34402f8 3.11

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 22, 2023
…of a for loop (pythonGH-108242)
(cherry picked from commit a1cc74c)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
@bedevere-bot

Copy link
Copy Markdown

GH-108275 is a backport of this pull request to the 3.12 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.12 only security fixes label Aug 22, 2023
@iritkatrieliritkatriel removed 3.11 only security fixes 3.12 only security fixes 3.13 bugs and security fixes labels Aug 22, 2023
Comment threadPython/flowgraph.c
return ERROR;
}
basicblock_addop(backwards_jump, JUMP, target->b_label.id, NO_LOCATION);
basicblock_addop(backwards_jump, JUMP, target->b_label.id, last->i_loc);

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.

This is the last physical location, not the last location executed. Won't it give the wrong line for the following?

ALWAYS_TRUE=Truedeffoo():
while1:
ifALWAYS_TRUE:
pass# last line executedelse:
pass# last physical line

@iritkatrieliritkatrielAug 22, 2023

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

no, last is the conditional backwards jump that this jump is replacing (and which is replaced by a forward jump).

Yhg1s pushed a commit that referenced this pull request Aug 22, 2023
… of a for loop (GH-108242) (#108275)
gh-107901: Fix missing line number on BACKWARD_JUMP at the end of a for loop (GH-108242)
(cherry picked from commit a1cc74c)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
@ZeroIntensityZeroIntensity removed type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) needs backport to 3.11 only security fixes labels Feb 17, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@iritkatriel@miss-islington@bedevere-bot@markshannon@sweeneyde@ZeroIntensity