Author: Armin Rigo <[email protected]>
Branch:
Changeset: r70537:82e80a7333b2
Date: 2014-04-10 14:42 +0200
http://bitbucket.org/pypy/pypy/changeset/82e80a7333b2/
Log: In 59519f8875b6 I made 'withmethodcache' mandatory to have
'withmapdict'. This reverts this dependency, with Yet Another
Lookup Method on W_TypeObjects, which can be called with or without
having the method cache.
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -217,7 +217,7 @@
"make instances really small but slow without the JIT",
default=False,
requires=[("objspace.std.getattributeshortcut", True),
- ("objspace.std.withmethodcache", True),
+ ("objspace.std.withtypeversion", True),
]),
BoolOption("withrangelist",
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -873,8 +873,7 @@
name = space.str_w(w_name)
# We need to care for obscure cases in which the w_descr is
# a TypeCell, which may change without changing the version_tag
- assert space.config.objspace.std.withmethodcache
- _, w_descr = w_type._pure_lookup_where_with_method_cache(
+ _, w_descr = w_type._pure_lookup_where_possibly_with_method_cache(
name, version_tag)
#
selector = ("", INVALID)
@@ -932,9 +931,8 @@
# in the class, this time taking care of the result: it can be either a
# quasi-constant class attribute, or actually a TypeCell --- which we
# must not cache. (It should not be None here, but you never know...)
- assert space.config.objspace.std.withmethodcache
- _, w_method = w_type._pure_lookup_where_with_method_cache(name,
- version_tag)
+ _, w_method = w_type._pure_lookup_where_possibly_with_method_cache(
+ name, version_tag)
if w_method is None or isinstance(w_method, TypeCell):
return
_fill_cache(pycode, nameindex, map, version_tag, -1, w_method)
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -371,6 +371,12 @@
w_class, w_value = w_self._pure_lookup_where_with_method_cache(name,
version_tag)
return w_class, unwrap_cell(space, w_value)
+ def _pure_lookup_where_possibly_with_method_cache(w_self, name,
version_tag):
+ if w_self.space.config.objspace.std.withmethodcache:
+ return w_self._pure_lookup_where_with_method_cache(name,
version_tag)
+ else:
+ return w_self._lookup_where_all_typeobjects(name)
+
@elidable
def _pure_lookup_where_with_method_cache(w_self, name, version_tag):
space = w_self.space
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit