Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r87739:57696c7e37eb
Date: 2016-10-12 21:26 +0200
http://bitbucket.org/pypy/pypy/changeset/57696c7e37eb/

Log:    merge heads

diff --git a/lib-python/3/pickle.py b/lib-python/3/pickle.py
--- a/lib-python/3/pickle.py
+++ b/lib-python/3/pickle.py
@@ -850,6 +850,7 @@
 
     def _pickle_maybe_moduledict(self, obj):
         # save module dictionary as "getattr(module, '__dict__')"
+        from types import ModuleType
         try:
             name = obj['__name__']
             if type(name) is not str:
@@ -1008,7 +1009,6 @@
             return self.save_reduce(type, (...,), obj=obj)
         return self.save_global(obj)
 
-    dispatch[FunctionType] = save_global
     dispatch[type] = save_type
 
 
diff --git a/pypy/interpreter/generator.py b/pypy/interpreter/generator.py
--- a/pypy/interpreter/generator.py
+++ b/pypy/interpreter/generator.py
@@ -47,20 +47,16 @@
 
     def descr__reduce__(self, space):
         from pypy.interpreter.mixedmodule import MixedModule
-        w_mod    = space.getbuiltinmodule('_pickle_support')
-        mod      = space.interp_w(MixedModule, w_mod)
+        w_mod = space.getbuiltinmodule('_pickle_support')
+        mod = space.interp_w(MixedModule, w_mod)
         new_inst = mod.get(self.KIND + '_new')
-        w        = space.wrap
+        w = space.wrap
         if self.frame:
             w_frame = self.frame._reduce_state(space)
         else:
             w_frame = space.w_None
 
-        tup = [
-            w_frame,
-            w(self.running),
-            ]
-
+        tup = [w_frame, w(self.running)]
         return space.newtuple([new_inst, space.newtuple([]),
                                space.newtuple(tup)])
 
@@ -72,6 +68,8 @@
             self.frame = None
             self.space = space
             self.pycode = None
+            self._name = None
+            self._qualname = None
         else:
             frame = instantiate(space.FrameClass)   # XXX fish
             frame.descr__setstate__(space, w_framestate)
diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py 
b/pypy/interpreter/test/test_zzpickle_and_slow.py
--- a/pypy/interpreter/test/test_zzpickle_and_slow.py
+++ b/pypy/interpreter/test/test_zzpickle_and_slow.py
@@ -244,9 +244,9 @@
         mod.myclass = myclass
         sys.modules['mod'] = mod
         try:
-            method   = myclass.f
-            pckl     = pickle.dumps(method)
-            result   = pickle.loads(pckl)
+            method = myclass.f
+            pckl = pickle.dumps(method)
+            result = pickle.loads(pckl)
             assert method() == result()
         finally:
             del sys.modules['mod']
@@ -351,6 +351,7 @@
         assert list(result) == [2,3,4]
 
     def test_pickle_generator(self):
+        self.skip_on_cpython()
         import types
         mod = types.ModuleType('mod')
         import sys
@@ -374,6 +375,7 @@
             del sys.modules['mod']
 
     def test_pickle_generator_blk(self):
+        self.skip_on_cpython()
         # same as above but with the generator inside a block
         import types
         mod = types.ModuleType('mod')
@@ -446,6 +448,7 @@
 
 
     def test_pickle_generator_crash(self):
+        self.skip_on_cpython()
         import pickle
 
         def f():
diff --git a/pypy/module/__builtin__/functional.py 
b/pypy/module/__builtin__/functional.py
--- a/pypy/module/__builtin__/functional.py
+++ b/pypy/module/__builtin__/functional.py
@@ -370,7 +370,7 @@
         else:
             return space.newtuple([
                 space.type(self),
-                space.newtuple([])])
+                space.newtuple([space.newtuple([])])])
 
     def descr___setstate__(self, space, w_state):
         self.remaining = space.int_w(w_state)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to