Skip to content

Commit 7fe1602

Browse files
committed
gh-98831: rewrite RAISE_VARARGS in the instruction definition DSL
1 parent 1a9d8c7 commit 7fe1602

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Python/bytecodes.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,27 +505,26 @@ dummy_func(
505505
ERROR_IF(res == NULL, error);
506506
}
507507

508-
// This should remain a legacy instruction.
509-
inst(RAISE_VARARGS) {
508+
inst(RAISE_VARARGS, (args[oparg] -- )) {
510509
PyObject *cause = NULL, *exc = NULL;
511510
switch (oparg) {
512511
case 2:
513-
cause = POP(); /* cause */
512+
cause = args[1];
514513
/* fall through */
515514
case 1:
516-
exc = POP(); /* exc */
515+
exc = args[0];
517516
/* fall through */
518517
case 0:
519518
if (do_raise(tstate, exc, cause)) {
520-
goto exception_unwind;
519+
ERROR_IF(true, exception_unwind);
521520
}
522521
break;
523522
default:
524523
_PyErr_SetString(tstate, PyExc_SystemError,
525524
"bad RAISE_VARARGS oparg");
526525
break;
527526
}
528-
goto error;
527+
ERROR_IF(true, error);
529528
}
530529

531530
inst(INTERPRETER_EXIT, (retval --)) {

Python/generated_cases.c.h

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)