From 36d18661dacdb482d2df402c37cc23e98ddc5488 Mon Sep 17 00:00:00 2001 From: Valentyn Tymofieiev Date: Thu, 6 Feb 2020 16:17:38 -0800 Subject: [PATCH 1/5] Avoid creating a side-effect in typing module. --- cloudpickle/cloudpickle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudpickle/cloudpickle.py b/cloudpickle/cloudpickle.py index 638ec28ee..cf672332b 100644 --- a/cloudpickle/cloudpickle.py +++ b/cloudpickle/cloudpickle.py @@ -95,7 +95,6 @@ PY3 = False PY2 = True else: - types.ClassType = type from pickle import _Pickler as Pickler from io import BytesIO as StringIO string_types = (str,) @@ -889,7 +888,8 @@ def save_global(self, obj, name=None, pack=struct.pack): Pickler.save_global(self, obj, name=name) dispatch[type] = save_global - dispatch[types.ClassType] = save_global + if PY2: + dispatch[types.ClassType] = save_global def save_instancemethod(self, obj): # Memoization rarely is ever useful due to python bounding From b3246a94d5eeefe9f052afeec0ce420b41268d40 Mon Sep 17 00:00:00 2001 From: Valentyn Tymofieiev Date: Thu, 6 Feb 2020 16:25:49 -0800 Subject: [PATCH 2/5] Fix lint --- cloudpickle/cloudpickle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudpickle/cloudpickle.py b/cloudpickle/cloudpickle.py index cf672332b..c48572323 100644 --- a/cloudpickle/cloudpickle.py +++ b/cloudpickle/cloudpickle.py @@ -889,7 +889,7 @@ def save_global(self, obj, name=None, pack=struct.pack): dispatch[type] = save_global if PY2: - dispatch[types.ClassType] = save_global + dispatch[types.ClassType] = save_global def save_instancemethod(self, obj): # Memoization rarely is ever useful due to python bounding From 930fd9b5f7f6ddb439529c859f697b1137608578 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Fri, 7 Feb 2020 18:24:15 +0100 Subject: [PATCH 3/5] Update changelog and target cloudpickle 1.3.0 directly --- CHANGES.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0ca5a92b4..577567111 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,9 +4,6 @@ - Fix a bug affecting dynamic modules occuring with modified builtins ([issue #316](https://github.com/cloudpipe/cloudpickle/issues/316)) -1.2.3 -===== - - Fix a bug affecting cloudpickle when non-modules objects are added into sys.modules ([PR #326](https://github.com/cloudpipe/cloudpickle/pull/326)). @@ -23,6 +20,10 @@ https://docs.python.org/3/library/pickle.html#example ([issue #308](https://github.com/cloudpipe/cloudpickle/pull/308)) +- Fix a side effect that would redefine `types.ClassTypes` as `type` + when importing cloudpickle. + ([issue #337](https://github.com/cloudpipe/cloudpickle/pull/337)) + 1.2.2 ===== From aed321566b71a0295aeddd3674375fc79027f9be Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Fri, 7 Feb 2020 18:25:21 +0100 Subject: [PATCH 4/5] Target 1.3.0 directly --- cloudpickle/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudpickle/__init__.py b/cloudpickle/__init__.py index 0369eec03..f0c49bbb2 100644 --- a/cloudpickle/__init__.py +++ b/cloudpickle/__init__.py @@ -8,4 +8,4 @@ if sys.version_info[:2] >= (3, 8): from cloudpickle.cloudpickle_fast import CloudPickler, dumps, dump -__version__ = '1.2.3dev0' +__version__ = '1.3.0dev0' From c3ad365e6c48c968691bf76342a2f69e1dde1720 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Fri, 7 Feb 2020 19:10:29 +0100 Subject: [PATCH 5/5] trigger ci