[pypy-svn] r64149 - in pypy/branch/wip-fix-stackless-O2-pickling/pypy/interpreter: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu Apr 16 12:49:52 CEST 2009
Author: cfbolz
Date: Thu Apr 16 12:49:52 2009
New Revision: 64149
Modified:
pypy/branch/wip-fix-stackless-O2-pickling/pypy/interpreter/gateway.py
pypy/branch/wip-fix-stackless-O2-pickling/pypy/interpreter/test/test_gateway.py
Log:
(cfbolz, pedronis, arigo around): the self_type needs to be part of the key that
is used to cache interp2app objects.
Modified: pypy/branch/wip-fix-stackless-O2-pickling/pypy/interpreter/gateway.py
==============================================================================
--- pypy/branch/wip-fix-stackless-O2-pickling/pypy/interpreter/gateway.py (original)
+++ pypy/branch/wip-fix-stackless-O2-pickling/pypy/interpreter/gateway.py Thu Apr 16 12:49:52 2009
@@ -742,7 +742,7 @@
unwrap_spec_key = tuple(unwrap_spec)
else:
unwrap_spec_key = None
- key = (f, unwrap_spec_key, descrmismatch, as_classmethod)
+ key = (f, self_type, unwrap_spec_key, descrmismatch, as_classmethod)
if key in cls.instancecache:
result = cls.instancecache[key]
assert result.__class__ is cls
Modified: pypy/branch/wip-fix-stackless-O2-pickling/pypy/interpreter/test/test_gateway.py
==============================================================================
--- pypy/branch/wip-fix-stackless-O2-pickling/pypy/interpreter/test/test_gateway.py (original)
+++ pypy/branch/wip-fix-stackless-O2-pickling/pypy/interpreter/test/test_gateway.py Thu Apr 16 12:49:52 2009
@@ -167,6 +167,19 @@
assert self.space.eq_w(space.call_function(w_app_g, space.wrap(True)),
space.wrap(True))
+ def test_caching_methods(self):
+ class Base(gateway.Wrappable):
+ def f(self):
+ return 1
+
+ class A(Base):
+ pass
+ class B(Base):
+ pass
+ app_A = gateway.interp2app(A.f)
+ app_B = gateway.interp2app(B.f)
+ assert app_A is not app_B
+
def test_interp2app_unwrap_spec_nonnegint(self):
space = self.space
w = space.wrap
More information about the Pypy-commit
mailing list