Skip to content

Commit

Permalink
Fix #82: Avoid creating a side-effect in typing module. (#337)
Browse files Browse the repository at this point in the history
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
  • Loading branch information
tvalentyn and ogrisel authored Feb 7, 2020
1 parent e0ad635 commit 4a95948
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand All @@ -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
=====

Expand Down
2 changes: 1 addition & 1 deletion cloudpickle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
4 changes: 2 additions & 2 deletions cloudpickle/cloudpickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4a95948

Please sign in to comment.