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-101400: Fix incorrect lineno in exception message on continue/break which are not in a loop#101413

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
iritkatriel merged 7 commits intopython:mainfromcorona10:gh-101400
Jan 30, 2023

Conversation

@corona10
Copy link
Member

@corona10corona10 commentedJan 30, 2023
edited by bedevere-bot
Loading

@corona10corona10 changed the titlegh-101400: Restore continue/break loc for the non-loop case[WIP] gh-101400: Restore continue/break loc for the non-loop caseJan 30, 2023
@corona10corona10 added needs backport to 3.10only security fixes needs backport to 3.11only security fixes labelsJan 30, 2023
@corona10corona10 marked this pull request as ready for reviewJanuary 30, 2023 04:44
@corona10corona10 changed the title[WIP] gh-101400: Restore continue/break loc for the non-loop casegh-101400: Restore continue/break loc for the non-loop caseJan 30, 2023
@corona10
Copy link
MemberAuthor

Without patch

======================================================================FAIL: test_unloop_break_continue (test.test_compile.TestSpecifics.test_unloop_break_continue) (stmt='break')----------------------------------------------------------------------Traceback (most recent call last):  File "/Users/user/oss/cpython/Lib/test/test_compile.py", line 856, in test_unloop_break_continue    self.assertEqual(exc.lineno, 2)AssertionError: -1 != 2======================================================================FAIL: test_unloop_break_continue (test.test_compile.TestSpecifics.test_unloop_break_continue) (stmt='continue')----------------------------------------------------------------------Traceback (most recent call last):  File "/Users/user/oss/cpython/Lib/test/test_compile.py", line 856, in test_unloop_break_continue    self.assertEqual(exc.lineno, 2)AssertionError: -1 != 2----------------------------------------------------------------------

@iritkatrieliritkatriel changed the titlegh-101400: Restore continue/break loc for the non-loop casegh-101400: Fix wrong lineno in exception message on continue/break which are not in a loopJan 30, 2023
source=f"with object() as obj:\n{stmt}"
compile(source,f"<unloop_{stmt}>","exec")
exc=err_ctx.exception
self.assertEqual(exc.lineno,2)
Copy link
Member

Choose a reason for hiding this comment

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

There are some tests for break and continue outside loops in Lib/test/test_syntax.py, I think the lineno check could be added there. For instance, test_break_outside_loop calls self._check_error() but doesn't pass an expected lineno, though it could. And a similar test for continue could be added next to it.

corona10 reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Done!

Copy link
Member

@iritkatrieliritkatriel left a comment

Choose a reason for hiding this comment

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

LGTM!

@iritkatrieliritkatriel changed the titlegh-101400: Fix wrong lineno in exception message on continue/break which are not in a loopgh-101400: Fix incorrect lineno in exception message on continue/break which are not in a loopJan 30, 2023
@iritkatrieliritkatriel merged commite867c1b intopython:mainJan 30, 2023
@miss-islington
Copy link
Contributor

Thanks@corona10 for the PR, and@iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry,@corona10 and@iritkatriel, I could not cleanly backport this to3.11 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker e867c1b753424d8d3f9c9ba0b431d007fd958c80 3.11

@miss-islington
Copy link
Contributor

Sorry@corona10 and@iritkatriel, I had trouble checking out the3.10 backport branch.
Please retry by removing and re-adding the "needs backport to 3.10" label.
Alternatively, you can backport usingcherry_picker on the command line.
cherry_picker e867c1b753424d8d3f9c9ba0b431d007fd958c80 3.10

@corona10
Copy link
MemberAuthor

@iritkatriel I will create the manual backport.

iritkatriel reacted with thumbs up emoji

corona10 added a commit to corona10/cpython that referenced this pull requestJan 31, 2023
…continue/break which are not in a loop (pythonGH-101413).(cherry picked from commite867c1b)Co-authored-by: Dong-hee Na <donghee.na@python.org>
@bedevere-bot
Copy link

GH-101447 is a backport of this pull request to the3.11 branch.

@bedevere-bot
Copy link

GH-101448 is a backport of this pull request to the3.10 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.10only security fixes labelJan 31, 2023
@corona10corona10 deleted the gh-101400 branchJanuary 31, 2023 03:36
corona10 added a commit to corona10/cpython that referenced this pull requestJan 31, 2023
…continue/break which are not in a loop (pythonGH-101413).(cherry picked from commite867c1b)Co-authored-by: Dong-hee Na <donghee.na@python.org>
corona10 added a commit to corona10/cpython that referenced this pull requestJan 31, 2023
…continue/break which are not in a loop (pythonGH-101413).(cherry picked from commite867c1b)Co-authored-by: Dong-hee Na <donghee.na@python.org>
mdboom pushed a commit to mdboom/cpython that referenced this pull requestJan 31, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@iritkatrieliritkatrieliritkatriel approved these changes

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

Assignees

@iritkatrieliritkatriel

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@corona10@miss-islington@bedevere-bot@iritkatriel

[8]ページ先頭

©2009-2025 Movatter.jp