Author: Matti Picus <[email protected]>
Branch: cpyext-pickle
Changeset: r84859:5d72cee32acb
Date: 2016-06-01 18:14 +0300
http://bitbucket.org/pypy/pypy/changeset/5d72cee32acb/

Log:    use space.appexec (arigato)

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
@@ -3,12 +3,6 @@
 from pypy.module.cpyext.state import State
 from pypy.module.cpyext import api
 
-add_pickle_key = gateway.applevel('''
-    def add_pickle_key(methodtype):
-        from pickle import Pickler 
-        Pickler.dispatch[methodtype] = Pickler.save_global
-''', filename=__file__).interphook('add_pickle_key')
-
 class Module(MixedModule):
     interpleveldefs = {
         'load_module': 'api.load_extension_module',
@@ -23,7 +17,10 @@
         space.fromcache(State).startup(space)
         method = pypy.module.cpyext.typeobject.get_new_method_def(space)
         w_obj = pypy.module.cpyext.methodobject.W_PyCFunctionObject(space, 
method, space.wrap(''))
-        add_pickle_key(space, space.type(w_obj))
+        space.appexec([space.type(w_obj)], """(methodtype):
+            from pickle import Pickler 
+            Pickler.dispatch[methodtype] = Pickler.save_global
+        """)
 
     def register_atexit(self, function):
         if len(self.atexit_funcs) >= 32:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to