gh-96711: Enhance SystemError message upon Invalid opcode (#96712)

Raise verbose SystemError instead of printing debug information
upon Invalid opcode.

Fix #96711
This commit is contained in:
serge-sans-paille 2022-09-20 10:00:34 +00:00 committed by GitHub
parent 6ad47b41a6
commit fc05107af9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View file

@ -5051,9 +5051,11 @@ handle_eval_breaker:
/* Tell C compilers not to hold the opcode variable in the loop.
next_instr points the current instruction without TARGET(). */
opcode = _Py_OPCODE(*next_instr);
fprintf(stderr, "XXX lineno: %d, opcode: %d\n",
_PyInterpreterFrame_GetLine(frame), opcode);
_PyErr_SetString(tstate, PyExc_SystemError, "unknown opcode");
_PyErr_Format(tstate, PyExc_SystemError,
"%U:%d: unknown opcode %d",
frame->f_code->co_filename,
_PyInterpreterFrame_GetLine(frame),
opcode);
goto error;
} /* End instructions */