Skip to content

[3.11] gh-101400: Fix incorrect lineno in exception message on contin… #101447

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 31, 2023

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Jan 31, 2023

…ue/break which are not in a loop (GH-101413).

(cherry picked from commit e867c1b)

Co-authored-by: Dong-hee Na [email protected]

…continue/break which are not in a loop (pythonGH-101413).

(cherry picked from commit e867c1b)

Co-authored-by: Dong-hee Na <[email protected]>
@corona10 corona10 force-pushed the backport-e867c1b-3.11 branch from 4e1f5bf to 2aa4010 Compare January 31, 2023 05:37
@corona10
Copy link
Member Author

We need to apply slightly different patches for 3.1[0-2]
For 3.11, when considering following the code line.

cpython/Python/compile.c

Lines 2060 to 2080 in 2aa4010

case WITH:
case ASYNC_WITH:
SET_LOC(c, (stmt_ty)info->fb_datum);
ADDOP(c, POP_BLOCK);
if (preserve_tos) {
ADDOP_I(c, SWAP, 2);
}
if(!compiler_call_exit_with_nones(c)) {
return 0;
}
if (info->fb_type == ASYNC_WITH) {
ADDOP_I(c, GET_AWAITABLE, 2);
ADDOP_LOAD_CONST(c, Py_None);
ADD_YIELD_FROM(c, 1);
}
ADDOP(c, POP_TOP);
/* The exit block should appear to execute after the
* statement causing the unwinding, so make the unwinding
* instruction artificial */
UNSET_LOC(c);
return 1;

I restore the whole compiler_unit.

@corona10 corona10 force-pushed the backport-e867c1b-3.11 branch from ff0cf41 to ca4887d Compare January 31, 2023 05:42
@corona10 corona10 requested a review from iritkatriel January 31, 2023 13:36
@corona10 corona10 requested a review from iritkatriel January 31, 2023 14:20
@corona10 corona10 merged commit 0c37ea9 into python:3.11 Jan 31, 2023
@corona10 corona10 deleted the backport-e867c1b-3.11 branch January 31, 2023 14:54
Sign up for free to 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.

3 participants