1. Pypy
  2. Untitled project
  3. pypy

Commits

Armin Rigo  committed c51e48d

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 576da3e
  • Branches stmgc-c7

Comments (0)

Files changed (3)

File pypy/config/pypyoption.py

View file
  • Ignore whitespace
                    "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",

File pypy/objspace/std/mapdict.py

View file
  • Ignore whitespace
             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):
         return
     _fill_cache(pycode, nameindex, map, version_tag, -1, w_method)

File pypy/objspace/std/typeobject.py

View file
  • Ignore whitespace
         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