summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2000-08-29 04:56:13 (GMT)
committerBarry Warsaw <barry@python.org>2000-08-29 04:56:13 (GMT)
commit093abe005d1017540c1c134f0f4107203a3cf8bd (patch)
tree5756f3e3662ddb71966a0ede9b42a4da0a9fbe41
parent9821bf4e62bcb7d503aed782a8f6398e5de720af (diff)
downloadcpython-093abe005d1017540c1c134f0f4107203a3cf8bd.zip
cpython-093abe005d1017540c1c134f0f4107203a3cf8bd.tar.gz
cpython-093abe005d1017540c1c134f0f4107203a3cf8bd.tar.bz2
eval_code2(): Guido provides this patch for his suggested elaboration
of extended print. If the file object being printed to is None, then sys.stdout is used.
-rw-r--r--Python/ceval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 53a5177..4b40197 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1230,7 +1230,7 @@ eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
case PRINT_ITEM:
v = POP();
- if (stream == NULL) {
+ if (stream == NULL || stream == Py_None) {
w = PySys_GetObject("stdout");
if (w == NULL) {
PyErr_SetString(PyExc_RuntimeError,
@@ -1263,7 +1263,7 @@ eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
/* fall through to PRINT_NEWLINE */
case PRINT_NEWLINE:
- if (stream == NULL) {
+ if (stream == NULL || stream == Py_None) {
w = PySys_GetObject("stdout");
if (w == NULL)
PyErr_SetString(PyExc_RuntimeError,