Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r86370:72416bdbe656
Date: 2016-08-21 10:28 +0200
http://bitbucket.org/pypy/pypy/changeset/72416bdbe656/

Log:    hg merge py3k

diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -387,24 +387,18 @@
         else:
             if not space.isinstance_w(w_new, space.w_dict):
                 raise oefmt(space.w_TypeError, "__kwdefaults__ must be a dict")
-            w_instance = self.init_kwdefaults_dict()
-            w_instance.setdict(space, w_new)
-            self.w_kw_defs = w_instance.getdict(space)
+            self.w_kw_defs = w_new
 
     def fdel_func_kwdefaults(self, space):
         self.w_kw_defs = None
 
-    def init_kwdefaults_dict(self, kw_defs_w=[]):
-        # use the mapdict logic to get at least not-too-bad JIT code
-        # from function calls with default values of kwonly arguments
+    def init_kwdefaults_dict(self, kw_defs_w):
+        # use the moduledict logic to get normally-constant entries
         space = self.space
-        w_class = space.fromcache(KwDefsClassCache).w_class
-        w_instance = space.call_function(w_class)
+        w_dict = space.newdict(module=True)
         for w_name, w_value in kw_defs_w:
-            attr = space.unicode_w(w_name).encode('utf-8')
-            w_instance.setdictvalue(space, attr, w_value)
-        self.w_kw_defs = w_instance.getdict(space)
-        return w_instance
+            space.setitem(w_dict, w_name, w_value)
+        self.w_kw_defs = w_dict
 
     def fget_func_doc(self, space):
         if self.w_doc is None:
@@ -705,12 +699,3 @@
     else:
         code = None
     return isinstance(code, BuiltinCode)
-
-
-class KwDefsClassCache:
-    def __init__(self, space):
-        self.w_class = space.appexec([], """():
-            class KwDefs:
-                pass
-            return KwDefs
-        """)
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
@@ -68,7 +68,7 @@
     @jit.elidable
     def find_map_attr(self, name, index):
         # attr cache
-        assert type(name) is str    # utf8-encoded
+        assert isinstance(name, str)    # utf8-encoded
         space = self.space
         cache = space.fromcache(MapAttrCache)
         SHIFT2 = r_uint.BITS - space.config.objspace.std.methodcachesizeexp
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to