[pypy-svn] r8835 - pypy/dist/pypy/translator
tismer at codespeak.net
tismer at codespeak.net
Thu Feb 3 17:38:14 CET 2005
Author: tismer
Date: Thu Feb 3 17:38:14 2005
New Revision: 8835
Modified:
pypy/dist/pypy/translator/geninterplevel.py
Log:
this version works wit _classobj, given that **kwds calls
are removed.
TODO (urgently): Make this a stand-alone tool and provide tests.
Modified: pypy/dist/pypy/translator/geninterplevel.py
==============================================================================
--- pypy/dist/pypy/translator/geninterplevel.py (original)
+++ pypy/dist/pypy/translator/geninterplevel.py Thu Feb 3 17:38:14 2005
@@ -99,17 +99,6 @@
"always append"
list.append(self, arg)
-class AugmentedFlowSpace(FlowObjSpace):
- def __init__(self):
- FlowObjSpace.__init__(self)
-## #Eeek
-## from pypy.objspace.std import Space
-## other_space = Space()
-## if not hasattr(self,"w_dict"):
-## self.w_dict = other_space.w_dict
-## if not hasattr(self,"w_TypeError"):
-## self.w_TypeError = other_space.w_TypeError
-
class GenRpy:
def __init__(self, translator, modname=None):
self.translator = translator
@@ -138,7 +127,7 @@
for name in "newtuple newlist newdict newstring".split():
self.has_listarg[name] = name
- self.space = AugmentedFlowSpace() # for introspection
+ self.space = FlowObjSpace() # for introspection
self.use_fast_call = False
@@ -853,7 +842,7 @@
f_name = 'f_' + cname[6:]
# collect all the local variables
- graph = self.translator.getflowgraph(func, SpaceClass=AugmentedFlowSpace)
+ graph = self.translator.getflowgraph(func)
localslst = []
def visit(node):
if isinstance(node, Block):
@@ -957,8 +946,7 @@
def rpyfunction_body(self, func, localvars):
try:
- graph = self.translator.getflowgraph(func,
- SpaceClass=AugmentedFlowSpace)
+ graph = self.translator.getflowgraph(func)
except Exception, e:
print 20*"*", e
print func
@@ -972,7 +960,7 @@
f = self.f
t = self.translator
#t.simplify(func)
- graph = t.getflowgraph(func, SpaceClass=AugmentedFlowSpace)
+ graph = t.getflowgraph(func)
start = graph.startblock
@@ -1088,10 +1076,15 @@
# entry point: %(entrypointname)s, %(entrypoint)s)
if __name__ == "__main__":
from pypy.objspace.std import StdObjSpace
+ from pypy.objspace.std.default import UnwrapError
space = StdObjSpace()
init%(modname)s(space)
- print space.unwrap(space.call(
- gfunc_%(entrypointname)s, space.newtuple([])))
+ ret = space.call(gfunc_%(entrypointname)s, space.newtuple([]))
+ try:
+ print space.unwrap(ret)
+ except UnwrapError:
+ print "cannot unwrap, here the wrapped result:"
+ print ret
'''
# a translation table suitable for str.translate() to remove
More information about the Pypy-commit
mailing list