[pypy-commit] pypy cpyext-refactor-methodobject: fix test_arraymodule:test_pickle by teaching pickle about all the W_PyCFunctionObject variants
antocuni
pypy.commits at gmail.com
Mon Oct 16 18:54:37 EDT 2017
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: cpyext-refactor-methodobject
Changeset: r92783:371b5a6f2316
Date: 2017-10-17 00:53 +0200
http://bitbucket.org/pypy/pypy/changeset/371b5a6f2316/
Log: fix test_arraymodule:test_pickle by teaching pickle about all the
W_PyCFunctionObject variants
diff --git a/pypy/module/cpyext/__init__.py b/pypy/module/cpyext/__init__.py
--- a/pypy/module/cpyext/__init__.py
+++ b/pypy/module/cpyext/__init__.py
@@ -16,11 +16,17 @@
space.fromcache(State).startup(space)
method = pypy.module.cpyext.typeobject.get_new_method_def(space)
# the w_self argument here is a dummy, the only thing done with w_obj
- # is call space.type on it
- w_obj = pypy.module.cpyext.methodobject.W_PyCFunctionObject(space, method, space.w_None)
- space.appexec([space.type(w_obj)], """(methodtype):
+ # is call type() on it
+ objs_w = [cls(space, method, space.w_None) for cls in (
+ pypy.module.cpyext.methodobject.W_PyCFunctionObject,
+ pypy.module.cpyext.methodobject.W_PyCFunctionObject_NOARGS,
+ pypy.module.cpyext.methodobject.W_PyCFunctionObject_O,
+ pypy.module.cpyext.methodobject.W_PyCFunctionObject_VARARGS)]
+ w_objs = space.newtuple(objs_w)
+ space.appexec([w_objs], """(methods):
from pickle import Pickler
- Pickler.dispatch[methodtype] = Pickler.save_global
+ for meth in methods:
+ Pickler.dispatch[type(meth)] = Pickler.save_global
""")
def register_atexit(self, function):
More information about the pypy-commit
mailing list