Armin Rigo  committed 82e80a7

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.

  • Participants
  • Parent commits ea5fb9b
  • Branches default

Comments (0)

Files changed (3)

File pypy/config/

                    "make instances really small but slow without the JIT",
                    requires=[("objspace.std.getattributeshortcut", True),
-                             ("objspace.std.withmethodcache", True),
+                             ("objspace.std.withtypeversion", True),

File pypy/objspace/std/

             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)
     # 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):
     _fill_cache(pycode, nameindex, map, version_tag, -1, w_method)

File pypy/objspace/std/

         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
+            return w_self._pure_lookup_where_with_method_cache(name, version_tag)
+        else:
+            return w_self._lookup_where_all_typeobjects(name)
     def _pure_lookup_where_with_method_cache(w_self, name, version_tag):
         space =