diff Python/bltinmodule.c @ 86978:6a1ce1fd1fc0

Issue #19512: builtin print() function uses an identifier instead of literal string "flush" to call the flush method
author Victor Stinner <victor.stinner@gmail.com>
date Thu, 07 Nov 2013 00:01:51 +0100
parents 40c73ccaee95
children 01c4a0af73cf
line wrap: on
line diff
--- a/Python/bltinmodule.c	Wed Nov 06 23:52:55 2013 +0100
+++ b/Python/bltinmodule.c	Thu Nov 07 00:01:51 2013 +0100
@@ -1547,6 +1547,7 @@
     static PyObject *dummy_args;
     PyObject *sep = NULL, *end = NULL, *file = NULL, *flush = NULL;
     int i, err;
+    _Py_IDENTIFIER(flush);
 
     if (dummy_args == NULL && !(dummy_args = PyTuple_New(0)))
         return NULL;
@@ -1613,7 +1614,7 @@
         if (do_flush == -1)
             return NULL;
         else if (do_flush) {
-            tmp = PyObject_CallMethod(file, "flush", "");
+            tmp = _PyObject_CallMethodId(file, &PyId_flush, "");
             if (tmp == NULL)
                 return NULL;
             else