[pypy-svn] rev 466 - in pypy/trunk/src/pypy: interpreter module objspace/std
mwh at codespeak.net
mwh at codespeak.net
Mon May 26 17:52:26 CEST 2003
Author: mwh
Date: Mon May 26 17:52:26 2003
New Revision: 466
Modified:
pypy/trunk/src/pypy/interpreter/baseobjspace.py
pypy/trunk/src/pypy/module/sysmodule.py
pypy/trunk/src/pypy/objspace/std/objspace.py
Log:
use our __import__ hook
Modified: pypy/trunk/src/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/baseobjspace.py (original)
+++ pypy/trunk/src/pypy/interpreter/baseobjspace.py Mon May 26 17:52:26 2003
@@ -28,6 +28,13 @@
self.w_builtins = self.getattr(w_builtin, self.wrap("__dict__"))
self.setitem(self.w_modules, self.wrap("__builtin__"), w_builtin)
+ def make_sys(self):
+ import pypy.module.sysmodule
+ self.sys = pypy.module.sysmodule.Sys(self)
+ self.w_sys = self.sys.wrap_me()
+ self.setitem(self.w_modules, self.wrap("sys"), self.w_sys)
+ self.setattr(self.w_sys, self.wrap("modules"), self.w_modules)
+
def initialize(self):
"""Abstract method that should put some minimal content into the
w_builtins."""
Modified: pypy/trunk/src/pypy/module/sysmodule.py
==============================================================================
--- pypy/trunk/src/pypy/module/sysmodule.py (original)
+++ pypy/trunk/src/pypy/module/sysmodule.py Mon May 26 17:52:26 2003
@@ -1,5 +1,6 @@
from pypy.interpreter.extmodule import *
+import sys
class Sys(BuiltinModule):
__pythonname__ = 'sys'
-
+ stdout = appdata(sys.stdout)
Modified: pypy/trunk/src/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/objspace.py (original)
+++ pypy/trunk/src/pypy/objspace/std/objspace.py Mon May 26 17:52:26 2003
@@ -39,12 +39,13 @@
setattr(self, 'w_' + c.__name__, w_c)
newstuff[c.__name__] = w_c
self.make_builtins()
+ self.make_sys()
# insert these into the newly-made builtins
for key, w_value in newstuff.items():
self.setitem(self.w_builtins, self.wrap(key), w_value)
# add a dummy __import__ XXX fixme
- w_import = self.wrap(__import__)
- self.setitem(self.w_builtins, self.wrap("__import__"), w_import)
+# w_import = self.wrap(__import__)
+# self.setitem(self.w_builtins, self.wrap("__import__"), w_import)
def wrap(self, x):
"Wraps the Python value 'x' into one of the wrapper classes."
More information about the Pypy-commit
mailing list