-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Description
Now that cloudpickle is including annotations, there are certain typing classes that fail to pickle in versions of python < 3.7 that are now raising errors when included as annotations:
## python 3.6.6
import typing
import cloudpickle
tt = typing.Union[str, typing.List[str]]
cloudpickle.dumps(tt, protocol=cloudpickle.DEFAULT_PROTOCOL) # always fails
# _pickle.PicklingError: Can't pickle typing.Union[str, typing.List[str]]: it's not the same object as typing.Union
def f(x: tt) -> tt:
return x
## passes in cloudpickle==0.5.3 because type annotations were ignored
## but fails in 0.5.4+
cloudpickle.dumps(f, protocol=cloudpickle.DEFAULT_PROTOCOL)All of this works fine in python 3.7
Related: python/typing#511
marcbllv and adamklein
Metadata
Metadata
Assignees
Labels
No labels