[pypy-svn] r9352 - in pypy/dist/pypy: interpreter interpreter/test module/builtin tool
hpk at codespeak.net
hpk at codespeak.net
Sat Feb 19 19:44:16 CET 2005
Author: hpk
Date: Sat Feb 19 19:44:16 2005
New Revision: 9352
Modified:
pypy/dist/pypy/interpreter/lazymodule.py
pypy/dist/pypy/interpreter/main.py
pypy/dist/pypy/interpreter/test/test_appinterp.py
pypy/dist/pypy/interpreter/test/test_interpreter.py
pypy/dist/pypy/module/builtin/compiling.py
pypy/dist/pypy/module/builtin/importing.py
pypy/dist/pypy/tool/pytestsupport.py
Log:
added a new module-method "call" which eases
calling functions of the builtin and sys module.
simplified some locations accordingly.
Modified: pypy/dist/pypy/interpreter/lazymodule.py
==============================================================================
--- pypy/dist/pypy/interpreter/lazymodule.py (original)
+++ pypy/dist/pypy/interpreter/lazymodule.py Sat Feb 19 19:44:16 2005
@@ -22,6 +22,10 @@
raise OperationError(space.w_AttributeError, space.wrap(name))
return w_value
+ def call(self, name, *args_w):
+ w_builtin = self.get(name)
+ return self.space.call_function(w_builtin, *args_w)
+
def getdictvalue(self, space, name):
try:
return space.getitem(self.w_dict, space.wrap(name))
Modified: pypy/dist/pypy/interpreter/main.py
==============================================================================
--- pypy/dist/pypy/interpreter/main.py (original)
+++ pypy/dist/pypy/interpreter/main.py Sat Feb 19 19:44:16 2005
@@ -14,9 +14,8 @@
from pypy.objspace.std import StdObjSpace
space = StdObjSpace()
- w_compile = space.builtin.get('compile')
w = space.wrap
- w_code = space.call_function(w_compile,
+ w_code = space.builtin.call('compile',
w(source), w(filename), w(cmd), w(0), w(0))
w_main = space.wrap('__main__')
mainmodule = module.Module(space, w_main)
Modified: pypy/dist/pypy/interpreter/test/test_appinterp.py
==============================================================================
--- pypy/dist/pypy/interpreter/test/test_appinterp.py (original)
+++ pypy/dist/pypy/interpreter/test/test_appinterp.py Sat Feb 19 19:44:16 2005
@@ -125,3 +125,4 @@
for name in ('somefunc', 'someappfunc', '__doc__', '__name__'):
assert name in module.__dict__
""")
+ assert space.is_true(w_module.call('somefunc'))
Modified: pypy/dist/pypy/interpreter/test/test_interpreter.py
==============================================================================
--- pypy/dist/pypy/interpreter/test/test_interpreter.py (original)
+++ pypy/dist/pypy/interpreter/test/test_interpreter.py Sat Feb 19 19:44:16 2005
@@ -10,10 +10,8 @@
source = str(py.code.Source(source).strip()) + '\n'
- #from pypy.module.builtin.compiling import compile
- w_compile = space.builtin.get('compile')
w = space.wrap
- w_code = space.call_function(w_compile,
+ w_code = space.builtin.call('compile',
w(source), w('<string>'), w('exec'), w(0), w(0))
ec = executioncontext.ExecutionContext(space)
Modified: pypy/dist/pypy/module/builtin/compiling.py
==============================================================================
--- pypy/dist/pypy/module/builtin/compiling.py (original)
+++ pypy/dist/pypy/module/builtin/compiling.py Sat Feb 19 19:44:16 2005
@@ -20,7 +20,7 @@
supplied_flags |= 4096
if not dont_inherit:
try:
- frame = space.call_function(space.sys.get('_getframe'))
+ frame = space.sys.call('_getframe')
except OperationError, e:
if not e.match(space, space.w_ValueError):
raise
Modified: pypy/dist/pypy/module/builtin/importing.py
==============================================================================
--- pypy/dist/pypy/module/builtin/importing.py (original)
+++ pypy/dist/pypy/module/builtin/importing.py Sat Feb 19 19:44:16 2005
@@ -24,8 +24,7 @@
if pkgdir is not None:
space.setattr(w_mod, w('__path__'), space.newlist([w(pkgdir)]))
w_dict = space.getattr(w_mod, w('__dict__'))
- w_execfile = space.builtin.get("execfile")
- space.call_function(w_execfile, w(f), w_dict, w_dict)
+ space.builtin.call('execfile', w(f), w_dict, w_dict)
w_mod = check_sys_modules(space, w_modulename)
if w_mod is not None and w_parent is not None:
space.setattr(w_parent, w_name, w_mod)
Modified: pypy/dist/pypy/tool/pytestsupport.py
==============================================================================
--- pypy/dist/pypy/tool/pytestsupport.py (original)
+++ pypy/dist/pypy/tool/pytestsupport.py Sat Feb 19 19:44:16 2005
@@ -140,14 +140,14 @@
w_locals)
except OperationError, e:
if e.match(space, w_ExpectedException):
- return space.call_function(space.sys.get('exc_info'))
+ return space.sys.call('exc_info')
raise
else:
try:
space.call_args(w_expr, __args__)
except OperationError, e:
if e.match(space, w_ExpectedException):
- return space.call_function(space.sys.get('exc_info'))
+ return space.sys.call('exc_info')
raise
raise OperationError(space.w_AssertionError,
space.wrap("DID NOT RAISE"))
More information about the Pypy-commit
mailing list