[pypy-svn] r9289 - pypy/branch/dist-interpapp/pypy/module/sys2

hpk at codespeak.net hpk at codespeak.net
Thu Feb 17 19:16:47 CET 2005


Author: hpk
Date: Thu Feb 17 19:16:47 2005
New Revision: 9289

Modified:
   pypy/branch/dist-interpapp/pypy/module/sys2/hook.py
Log:
move the displayhook to use one layer of applevel code less 


Modified: pypy/branch/dist-interpapp/pypy/module/sys2/hook.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/module/sys2/hook.py	(original)
+++ pypy/branch/dist-interpapp/pypy/module/sys2/hook.py	Thu Feb 17 19:16:47 2005
@@ -1,13 +1,11 @@
+from pypy.interpreter.pyopcode import print_item_to, sys_stdout 
 
 def displayhook(space, w_obj):
     if not space.is_w(w_obj, space.w_None): 
         space.setitem(space.builtin.w_dict, space.wrap('_'), w_obj)
         # NB. this is slightly more complicated in CPython,
         # see e.g. the difference with  >>> print 5,; 8
-        space.appexec([w_obj], """
-            (obj): 
-                print `obj` 
-        """)
+        print_item_to(space, w_obj, sys_stdout(space))
 
 __displayhook__ = displayhook  # this is exactly like in CPython
 



More information about the Pypy-commit mailing list