[pypy-svn] r5141 - pypy/trunk/src/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Thu Jun 17 11:00:05 CEST 2004


Author: arigo
Date: Thu Jun 17 11:00:04 2004
New Revision: 5141

Modified:
   pypy/trunk/src/pypy/interpreter/pyopcode.py
Log:
print >> None actually means print >> sys.stdout.  Thanks mwh.


Modified: pypy/trunk/src/pypy/interpreter/pyopcode.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/pyopcode.py	(original)
+++ pypy/trunk/src/pypy/interpreter/pyopcode.py	Thu Jun 17 11:00:04 2004
@@ -274,6 +274,8 @@
     def PRINT_ITEM_TO(f):
         w_stream = f.valuestack.pop()
         w_item = f.valuestack.pop()
+        if w_stream == f.space.w_None:
+            w_stream = sys_stdout(f.space)   # grumble grumble special cases
         print_item_to(f.space, w_item, w_stream)
 
     def PRINT_ITEM(f):
@@ -282,6 +284,8 @@
 
     def PRINT_NEWLINE_TO(f):
         w_stream = f.valuestack.pop()
+        if w_stream == f.space.w_None:
+            w_stream = sys_stdout(f.space)   # grumble grumble special cases
         print_newline_to(f.space, w_stream)
 
     def PRINT_NEWLINE(f):
@@ -824,8 +828,6 @@
         raise RuntimeError("lost sys.stdout")
 
 def app_print_item_to(x, stream):
-    if stream is None:
-        return
     if file_softspace(stream, False):
         stream.write(" ")
     stream.write(str(x))
@@ -837,8 +839,6 @@
     file_softspace(stream, True)
 
 def app_print_newline_to(stream):
-    if stream is None:
-        return
     stream.write("\n")
     file_softspace(stream, False)
 



More information about the Pypy-commit mailing list