[Python-checkins] cpython: Issue #19512: PRINT_EXPR bytecode now uses an identifier to get sys.displayhook

victor.stinner python-checkins at python.org
Wed Nov 6 22:46:28 CET 2013


http://hg.python.org/cpython/rev/cca13dd603a9
changeset:   86972:cca13dd603a9
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Nov 06 22:38:37 2013 +0100
summary:
  Issue #19512: PRINT_EXPR bytecode now uses an identifier to get sys.displayhook
to only create the "displayhook" string once

files:
  Python/ceval.c |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1840,8 +1840,9 @@
         }
 
         TARGET(PRINT_EXPR) {
+            _Py_IDENTIFIER(displayhook);
             PyObject *value = POP();
-            PyObject *hook = PySys_GetObject("displayhook");
+            PyObject *hook = _PySys_GetObjectId(&PyId_displayhook);
             PyObject *res;
             if (hook == NULL) {
                 PyErr_SetString(PyExc_RuntimeError,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list