Skip to content

Commit 4a95948

Browse files
tvalentynogrisel
andauthored
Fix #82: Avoid creating a side-effect in typing module. (#337)
Co-authored-by: Olivier Grisel <[email protected]>
1 parent e0ad635 commit 4a95948

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Diff for: CHANGES.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
- Fix a bug affecting dynamic modules occuring with modified builtins
55
([issue #316](https://github.com/cloudpipe/cloudpickle/issues/316))
66

7-
1.2.3
8-
=====
9-
107
- Fix a bug affecting cloudpickle when non-modules objects are added into
118
sys.modules
129
([PR #326](https://github.com/cloudpipe/cloudpickle/pull/326)).
@@ -23,6 +20,10 @@
2320
https://docs.python.org/3/library/pickle.html#example
2421
([issue #308](https://github.com/cloudpipe/cloudpickle/pull/308))
2522

23+
- Fix a side effect that would redefine `types.ClassTypes` as `type`
24+
when importing cloudpickle.
25+
([issue #337](https://github.com/cloudpipe/cloudpickle/pull/337))
26+
2627
1.2.2
2728
=====
2829

Diff for: cloudpickle/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
if sys.version_info[:2] >= (3, 8):
99
from cloudpickle.cloudpickle_fast import CloudPickler, dumps, dump
1010

11-
__version__ = '1.2.3dev0'
11+
__version__ = '1.3.0dev0'

Diff for: cloudpickle/cloudpickle.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
PY3 = False
9696
PY2 = True
9797
else:
98-
types.ClassType = type
9998
from pickle import _Pickler as Pickler
10099
from io import BytesIO as StringIO
101100
string_types = (str,)
@@ -889,7 +888,8 @@ def save_global(self, obj, name=None, pack=struct.pack):
889888
Pickler.save_global(self, obj, name=name)
890889

891890
dispatch[type] = save_global
892-
dispatch[types.ClassType] = save_global
891+
if PY2:
892+
dispatch[types.ClassType] = save_global
893893

894894
def save_instancemethod(self, obj):
895895
# Memoization rarely is ever useful due to python bounding

0 commit comments

Comments
 (0)