[pypy-svn] r15080 - in pypy/dist/pypy: objspace/std tool translator/goal
hpk at codespeak.net
hpk at codespeak.net
Mon Jul 25 21:13:36 CEST 2005
Author: hpk
Date: Mon Jul 25 21:13:35 2005
New Revision: 15080
Modified:
pypy/dist/pypy/objspace/std/objspace.py
pypy/dist/pypy/tool/option.py
pypy/dist/pypy/translator/goal/targetpypymain.py
Log:
(rxe,hpk)
- move unfaking of files to the stdobjspace
- targetpypymain.py now does unfaking of files
by default
Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py (original)
+++ pypy/dist/pypy/objspace/std/objspace.py Mon Jul 25 21:13:35 2005
@@ -124,6 +124,28 @@
self.w_classobj = w_classobj
self.w_instance = w_instance
+ def unfakefile(self):
+ """ NOT_RPYTHON use our application level file implementation
+ including re-wrapping sys.stdout/err/in
+ """
+ self.appexec([], '''():
+ from _file import file
+ __builtins__.file = __builtins__.open = file
+ import sys
+ sys.stdout = file.fdopen(sys.stdout.fileno(),
+ sys.stdout.mode,
+ buffering=1)
+ sys.stdin = file.fdopen(sys.stdin.fileno(),
+ sys.stdin.mode,
+ buffering=1)
+ sys.stderr = file.fdopen(sys.stderr.fileno(),
+ sys.stderr.mode,
+ buffering=0)
+ sys.__stdout__ = sys.stdout
+ sys.__stderr__ = sys.stderr
+ sys.__stdin__ = sys.stdin
+ ''')
+
def setup_exceptions(self):
"""NOT_RPYTHON"""
## hacking things in
@@ -233,6 +255,7 @@
w_result = self.wrap_exception_cls(x)
if w_result is not None:
return w_result
+ #print "fake-wrapping", x
from fake import fake_object
return fake_object(self, x)
Modified: pypy/dist/pypy/tool/option.py
==============================================================================
--- pypy/dist/pypy/tool/option.py (original)
+++ pypy/dist/pypy/tool/option.py Mon Jul 25 21:13:35 2005
@@ -89,22 +89,6 @@
if name == 'std' and Options.oldstyle:
space.enable_old_style_classes_as_default_metaclass()
if Options.uselibfile:
- space.appexec([], '''():
- from _file import file
- __builtins__.file = __builtins__.open = file
- import sys
- sys.stdout = file.fdopen(sys.stdout.fileno(),
- sys.stdout.mode,
- buffering=1)
- sys.stdin = file.fdopen(sys.stdin.fileno(),
- sys.stdin.mode,
- buffering=1)
- sys.stderr = file.fdopen(sys.stderr.fileno(),
- sys.stderr.mode,
- buffering=0)
- sys.__stdout__ = sys.stdout
- sys.__stderr__ = sys.stderr
- sys.__stdin__ = sys.stdin
- ''')
+ space.unfakefile()
return _spacecache.setdefault(name, space)
Modified: pypy/dist/pypy/translator/goal/targetpypymain.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetpypymain.py (original)
+++ pypy/dist/pypy/translator/goal/targetpypymain.py Mon Jul 25 21:13:35 2005
@@ -39,6 +39,7 @@
gateway.ApplevelClass.use_geninterp = False
space = StdObjSpace()
+ space.unfakefile()
# manually imports app_main.py
filename = os.path.join(this_dir, 'app_main.py')
More information about the Pypy-commit
mailing list