Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Without patch |
Lib/test/test_compile.py Outdated
| source=f"with object() as obj:\n{stmt}" | ||
| compile(source,f"<unloop_{stmt}>","exec") | ||
| exc=err_ctx.exception | ||
| self.assertEqual(exc.lineno,2) |
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.
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.
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.
Done!
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Core and Builtins/2023-01-30-08-59-47.gh-issue-101400.Di_ZFm.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
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.
LGTM!
Thanks@corona10 for the PR, and@iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
Sorry,@corona10 and@iritkatriel, I could not cleanly backport this to |
Sorry@corona10 and@iritkatriel, I had trouble checking out the |
@iritkatriel I will create the manual backport. |
…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 commentedJan 31, 2023
GH-101447 is a backport of this pull request to the3.11 branch. |
bedevere-bot commentedJan 31, 2023
GH-101448 is a backport of this pull request to the3.10 branch. |
…continue/break which are not in a loop (pythonGH-101413).(cherry picked from commite867c1b)Co-authored-by: Dong-hee Na <donghee.na@python.org>
…continue/break which are not in a loop (pythonGH-101413).(cherry picked from commite867c1b)Co-authored-by: Dong-hee Na <donghee.na@python.org>
…e/break which are not in a loop (python#101413)
Uh oh!
There was an error while loading.Please reload this page.