diff Python/ceval.c @ 14238:74f7f237f739 legacy-trunk

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.
author Barry Warsaw <barry@python.org>
date Tue, 29 Aug 2000 04:56:13 +0000
parents 1f1a156ed5af
children cd8b815cb196
line wrap: on
line diff
--- a/Python/ceval.c	Tue Aug 29 01:15:18 2000 +0000
+++ b/Python/ceval.c	Tue Aug 29 04:56:13 2000 +0000
@@ -1230,7 +1230,7 @@
 
 		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 @@
 			/* 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,