[pypy-svn] r7435 - pypy/trunk/src/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Fri Nov 19 13:10:32 CET 2004
Author: arigo
Date: Fri Nov 19 13:10:31 2004
New Revision: 7435
Modified:
pypy/trunk/src/pypy/objspace/std/fake.py
pypy/trunk/src/pypy/objspace/std/objspace.py
Log:
Removed a double level of caches.
Modified: pypy/trunk/src/pypy/objspace/std/fake.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/fake.py (original)
+++ pypy/trunk/src/pypy/objspace/std/fake.py Fri Nov 19 13:10:31 2004
@@ -32,11 +32,11 @@
w_value = space.wrap(value)
raise OperationError, OperationError(w_exc, w_value), tb
-def fake_type(cpy_type, ignored=None):
+def fake_type(cpy_type):
assert type(cpy_type) is type
- if cpy_type in _fake_type_cache.content:
- return _fake_type_cache.content[cpy_type]
- assert not _fake_type_cache.frozen
+ return _fake_type_cache.getorbuild(cpy_type, really_build_fake_type, None)
+
+def really_build_fake_type(cpy_type, ignored):
print 'faking %r'%(cpy_type,)
kw = {}
for s, v in cpy_type.__dict__.items():
@@ -70,7 +70,6 @@
return w_obj.val
StdObjSpace.unwrap.register(fake_unwrap, W_Fake)
W_Fake.typedef.fakedcpytype = cpy_type
- _fake_type_cache.content[cpy_type] = W_Fake
return W_Fake
# ____________________________________________________________
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 Fri Nov 19 13:10:31 2004
@@ -137,7 +137,6 @@
def initialize(self):
self._typecache = Cache()
- self._faketypecache = Cache()
# The object implementations that we want to 'link' into PyPy must be
# imported here. This registers them into the multimethod tables,
@@ -258,9 +257,9 @@
assert isinstance(w_result, W_TypeObject)
return w_result
if isinstance(x, type):
- ft = self.loadfromcache(x, fake_type, self._faketypecache)
+ ft = fake_type(x)
return self.gettypeobject(ft.typedef)
- ft = self.loadfromcache(type(x), fake_type, self._faketypecache)
+ ft = fake_type(type(x))
return ft(self, x)
wrap._specialize_ = "argtypes"
More information about the Pypy-commit
mailing list