[pypy-svn] r50719 - pypy/dist/pypy/objspace/std
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu Jan 17 18:25:34 CET 2008
Author: cfbolz
Date: Thu Jan 17 18:25:32 2008
New Revision: 50719
Modified:
pypy/dist/pypy/objspace/std/dictmultiobject.py
pypy/dist/pypy/objspace/std/dictobject.py
pypy/dist/pypy/objspace/std/listmultiobject.py
pypy/dist/pypy/objspace/std/listobject.py
pypy/dist/pypy/objspace/std/objspace.py
Log:
fix a bug in the std object space that only occurred in combination with the
reflective object space: createexecutioncontext must not call space methods
that need the execution context to already exist.
Modified: pypy/dist/pypy/objspace/std/dictmultiobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dictmultiobject.py (original)
+++ pypy/dist/pypy/objspace/std/dictmultiobject.py Thu Jan 17 18:25:32 2008
@@ -1286,7 +1286,10 @@
def repr__DictMulti(space, w_dict):
if w_dict.implementation.length() == 0:
return space.wrap('{}')
- w_currently_in_repr = space.getexecutioncontext()._py_repr
+ ec = space.getexecutioncontext()
+ w_currently_in_repr = ec._py_repr
+ if w_currently_in_repr is None:
+ w_currently_in_repr = ec._py_repr = space.newdict()
return dictrepr(space, w_currently_in_repr, w_dict)
Modified: pypy/dist/pypy/objspace/std/dictobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dictobject.py (original)
+++ pypy/dist/pypy/objspace/std/dictobject.py Thu Jan 17 18:25:32 2008
@@ -217,7 +217,10 @@
def repr__Dict(space, w_dict):
if len(w_dict.content) == 0:
return space.wrap('{}')
- w_currently_in_repr = space.getexecutioncontext()._py_repr
+ ec = space.getexecutioncontext()
+ w_currently_in_repr = ec._py_repr
+ if w_currently_in_repr is None:
+ w_currently_in_repr = ec._py_repr = space.newdict()
return dictrepr(space, w_currently_in_repr, w_dict)
Modified: pypy/dist/pypy/objspace/std/listmultiobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/listmultiobject.py (original)
+++ pypy/dist/pypy/objspace/std/listmultiobject.py Thu Jan 17 18:25:32 2008
@@ -1154,7 +1154,10 @@
def repr__ListMulti(space, w_list):
if w_list.implementation.length() == 0:
return space.wrap('[]')
- w_currently_in_repr = space.getexecutioncontext()._py_repr
+ ec = space.getexecutioncontext()
+ w_currently_in_repr = ec._py_repr
+ if w_currently_in_repr is None:
+ w_currently_in_repr = ec._py_repr = space.newdict()
return listrepr(space, w_currently_in_repr, w_list)
def list_insert__ListMulti_ANY_ANY(space, w_list, w_where, w_any):
Modified: pypy/dist/pypy/objspace/std/listobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/listobject.py (original)
+++ pypy/dist/pypy/objspace/std/listobject.py Thu Jan 17 18:25:32 2008
@@ -327,7 +327,10 @@
def repr__List(space, w_list):
if len(w_list.wrappeditems) == 0:
return space.wrap('[]')
- w_currently_in_repr = space.getexecutioncontext()._py_repr
+ ec = space.getexecutioncontext()
+ w_currently_in_repr = ec._py_repr
+ if w_currently_in_repr is None:
+ w_currently_in_repr = ec._py_repr = space.newdict()
return listrepr(space, w_currently_in_repr, w_list)
def list_insert__List_ANY_ANY(space, w_list, w_where, w_any):
Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py (original)
+++ pypy/dist/pypy/objspace/std/objspace.py Thu Jan 17 18:25:32 2008
@@ -364,8 +364,10 @@
def createexecutioncontext(self):
# add space specific fields to execution context
+ # note that this method must not call space methods that might need an
+ # execution context themselves (e.g. nearly all space methods)
ec = ObjSpace.createexecutioncontext(self)
- ec._py_repr = self.newdict()
+ ec._py_repr = None
if self.config.objspace.std.withmethodcache:
SIZE = 1 << self.config.objspace.std.methodcachesizeexp
ec.method_cache_versions = [None] * SIZE
More information about the Pypy-commit
mailing list