Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 194
Optionally use pickle5 (Redux)#370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
a860509ee722f1d69ca866264641dc9ba84d5ed4d9c44ad88fd67f4b9740b22c657fe11f2410febaf7f61d6abbdfb34d27a15782f35e39d0a03a1abcdaeec595fdce038ed5f55334e79abbb978eb536de53111d39d566329e92413043ff8109d9e33f74372a829b919f69340146405e5f57df63df6fa9b20a522b3908dfee5deaf6ff2baa913a76f9393b31252746b9b531b14e85ab4d2a82a4121c82b94fb4ca55909c382822390d2399438deef74bb3436f884ee893b984920469528371d015d661ce64de14b2a0f8d73ca07fce96fe5c078602e2dad29384dcbf3e677a114cd7cd1a8eba950bff0786fccb9e30d11d660522cfb149b01e695cbb8adc122071dcd2ae4fc3a0e41b4dd46886435bfb9f3794cd9db9ccea7afec1591dc8dd895029996530ff67aabd2a4d338775800bb64e1bc25cc5efb2ec3468ed5887747b3f1a78178a2cdc8bd288a890f55cdb5e1268778bf17b31aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import sys | ||
| if sys.version_info < (3, 8): | ||
| try: | ||
| import pickle5 as pickle # noqa: F401 | ||
| from pickle5 import Pickler # noqa: F401 | ||
| except ImportError: | ||
| import pickle # noqa: F401 | ||
| from pickle import _Pickler as Pickler # noqa: F401 | ||
| else: | ||
| import pickle # noqa: F401 | ||
| from _pickle import Pickler # noqa: F401 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,7 +9,6 @@ | ||
| import logging | ||
| import math | ||
| from operator import itemgetter, attrgetter | ||
| import pickle | ||
| import platform | ||
| import random | ||
| import shutil | ||
| @@ -43,6 +42,7 @@ | ||
| tornado = None | ||
| import cloudpickle | ||
| from cloudpickle.compat import pickle | ||
| from cloudpickle.cloudpickle import _is_importable | ||
| from cloudpickle.cloudpickle import _make_empty_cell, cell_set | ||
| from cloudpickle.cloudpickle import _extract_class_dict, _whichmodule | ||
| @@ -521,7 +521,7 @@ def test_module_locals_behavior(self): | ||
| pickled_func_path = os.path.join(self.tmpdir, 'local_func_g.pkl') | ||
| child_process_script = ''' | ||
| import pickle | ||
| from cloudpickle.compat import pickle | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using | ||
| import gc | ||
| with open("{pickled_func_path}", 'rb') as f: | ||
| func = pickle.load(f) | ||
| @@ -606,7 +606,7 @@ def test_load_dynamic_module_in_grandchild_process(self): | ||
| child_process_module_file = os.path.join( | ||
| self.tmpdir, 'dynamic_module_from_child_process.pkl') | ||
| child_process_script = ''' | ||
| import pickle | ||
| from cloudpickle.compat import pickle | ||
| import textwrap | ||
| import cloudpickle | ||
| @@ -626,7 +626,7 @@ def test_load_dynamic_module_in_grandchild_process(self): | ||
| # The script ran by the process created by the child process | ||
| child_of_child_process_script = """ ''' | ||
| import pickle | ||
| from cloudpickle.compat import pickle | ||
| with open('{child_process_module_file}','rb') as fid: | ||
| mod = pickle.load(fid) | ||
| ''' """ | ||
| @@ -681,7 +681,7 @@ def my_small_function(x, y): | ||
| assert b'math' not in b | ||
| def test_module_importability(self): | ||
| import pickle # decouple this test from global imports | ||
| from cloudpickle.compat import pickle | ||
| import os.path | ||
| import distutils | ||
| import distutils.ccompiler | ||
| @@ -1008,7 +1008,8 @@ def example(): | ||
| # choose "subprocess" rather than "multiprocessing" because the latter | ||
| # library uses fork to preserve the parent environment. | ||
| command = ("import pickle, base64; " | ||
| command = ("import base64; " | ||
| "from cloudpickle.compat import pickle; " | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto: MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In both of these test cases, we are using the highest supported protocol with Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case I agree. Thanks. | ||
| "pickle.loads(base64.b32decode('" + | ||
| base64.b32encode(s).decode('ascii') + | ||
| "'))()") | ||
| @@ -1029,7 +1030,8 @@ def example(): | ||
| s = cloudpickle.dumps(example, protocol=self.protocol) | ||
| command = ("import pickle, base64; " | ||
| command = ("import base64; " | ||
| "from cloudpickle.compat import pickle; " | ||
| "pickle.loads(base64.b32decode('" + | ||
| base64.b32encode(s).decode('ascii') + | ||
| "'))()") | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we don't have to skip
numpy+Python 3.5after all? nice :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed :) PR ( numpy/numpy#16439 ) added Python 3.5 support