[pypy-svn] r11722 - in pypy/dist/pypy: interpreter translator
pedronis at codespeak.net
pedronis at codespeak.net
Sun May 1 20:14:40 CEST 2005
Author: pedronis
Date: Sun May 1 20:14:40 2005
New Revision: 11722
Modified:
pypy/dist/pypy/interpreter/gateway.py
pypy/dist/pypy/translator/geninterplevel.py
pypy/dist/pypy/translator/gensupp.py
Log:
let all applevel helpers' module be called __builtin__
changes to geninterplevel to be able to translate a module with __name__='__builtin__'
Modified: pypy/dist/pypy/interpreter/gateway.py
==============================================================================
--- pypy/dist/pypy/interpreter/gateway.py (original)
+++ pypy/dist/pypy/interpreter/gateway.py Sun May 1 20:14:40 2005
@@ -532,6 +532,7 @@
"NOT_RPYTHON"
code = self._buildcode(space, self.code)
w_glob = space.newdict([])
+ space.setitem(w_glob, space.wrap('__name__'), space.wrap('__builtin__'))
space.exec_(code, w_glob, w_glob)
return w_glob
@@ -569,7 +570,7 @@
"""
NOT_RPYTHON_ATTRIBUTES = ['cache_path', 'known_source']
- def __init__(self, source, filename = None, modname = 'applevelinterp', do_imports=False):
+ def __init__(self, source, filename = None, modname = '__builtin__', do_imports=False):
"NOT_RPYTHON"
self.filename = filename
self.source = source
@@ -686,7 +687,7 @@
_setup = classmethod(_setup)
def applevel(source, filename = None,
- modname = 'applevelinterp', do_imports=False):
+ modname = '__builtin__', do_imports=False):
# look at the first three lines
first = source.split("\n", 3)[:3]
klass = ApplevelInterpClass
Modified: pypy/dist/pypy/translator/geninterplevel.py
==============================================================================
--- pypy/dist/pypy/translator/geninterplevel.py (original)
+++ pypy/dist/pypy/translator/geninterplevel.py Sun May 1 20:14:40 2005
@@ -19,6 +19,7 @@
from __future__ import generators
import autopath, os, sys, exceptions, inspect, types
import cPickle as pickle, __builtin__
+from copy_reg import _HEAPTYPE
from pypy.objspace.flow.model import Variable, Constant, SpaceOperation
from pypy.objspace.flow.model import FunctionGraph, Block, Link
from pypy.objspace.flow.model import last_exception, last_exc_value
@@ -41,7 +42,7 @@
import pypy # __path__
import py.path
-GI_VERSION = '1.0.3' # bump this for substantial changes
+GI_VERSION = '1.0.5' # bump this for substantial changes
# ____________________________________________________________
def eval_helper(self, typename, expr):
@@ -576,10 +577,10 @@
break
else:
raise Exception, '%r not found in any built-in module' % (func,)
- if modname == '__builtin__':
- # be lazy
- return "(space.builtin.get(space.str_w(%s)))" % self.nameof(func.__name__)
- elif modname == 'sys':
+ #if modname == '__builtin__':
+ # # be lazy
+ # return "(space.builtin.get(space.str_w(%s)))" % self.nameof(func.__name__)
+ if modname == 'sys':
# be lazy
return "(space.sys.get(space.str_w(%s)))" % self.nameof(func.__name__)
else:
@@ -729,7 +730,7 @@
if type(ret) is tuple:
ret = ret[0](self, ret[1], ret[2])
return ret
- assert cls.__module__ != '__builtin__', (
+ assert cls.__module__ != '__builtin__' or cls.__flags__&_HEAPTYPE, (
"built-in class %r not found in typename_mapping "
"while compiling %s" % (cls, self.currentfunc and
self.currentfunc.__name__ or "*no function at all*"))
Modified: pypy/dist/pypy/translator/gensupp.py
==============================================================================
--- pypy/dist/pypy/translator/gensupp.py (original)
+++ pypy/dist/pypy/translator/gensupp.py Sun May 1 20:14:40 2005
@@ -54,7 +54,8 @@
def builtin_base(obj):
typ = type(obj)
- while typ.__module__ != '__builtin__':
+ from copy_reg import _HEAPTYPE
+ while typ.__flags__&_HEAPTYPE:
typ = typ.__base__
return typ
More information about the Pypy-commit
mailing list