gh-98831: rewrite RAISE_VARARGS in the instruction definition DSL (#101306)

This commit is contained in:
Irit Katriel 2023-01-25 22:29:56 +00:00 committed by GitHub
parent 6162a0e305
commit b400219df5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 18 deletions

View file

@ -505,27 +505,24 @@ dummy_func(
ERROR_IF(res == NULL, error);
}
// This should remain a legacy instruction.
inst(RAISE_VARARGS) {
inst(RAISE_VARARGS, (args[oparg] -- )) {
PyObject *cause = NULL, *exc = NULL;
switch (oparg) {
case 2:
cause = POP(); /* cause */
cause = args[1];
/* fall through */
case 1:
exc = POP(); /* exc */
exc = args[0];
/* fall through */
case 0:
if (do_raise(tstate, exc, cause)) {
goto exception_unwind;
}
ERROR_IF(do_raise(tstate, exc, cause), exception_unwind);
break;
default:
_PyErr_SetString(tstate, PyExc_SystemError,
"bad RAISE_VARARGS oparg");
break;
}
goto error;
ERROR_IF(true, error);
}
inst(INTERPRETER_EXIT, (retval --)) {