Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cab75e3

Browse files
committed
Issue #19512: PRINT_EXPR bytecode now uses an identifier to get sys.displayhook
to only create the "displayhook" string once
1 parent d67bd45 commit cab75e3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Python/ceval.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,8 +1840,9 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
18401840
}
18411841

18421842
TARGET(PRINT_EXPR) {
1843+
_Py_IDENTIFIER(displayhook);
18431844
PyObject *value = POP();
1844-
PyObject *hook = PySys_GetObject("displayhook");
1845+
PyObject *hook = _PySys_GetObjectId(&PyId_displayhook);
18451846
PyObject *res;
18461847
if (hook == NULL) {
18471848
PyErr_SetString(PyExc_RuntimeError,

0 commit comments

Comments
 (0)