cloudpipe / cloudpipe/cloudpickle
cloudpickle fails to pickle NewType in main module by value on Python 3.10 and newer
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 195
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 1
Description
In a.py:
```
import cloudpickle
from typing import Any, NewType
RunDict = NewType("RunDict", dict[str, Any])
with open("tmp.pickle", "wb") as f:
f.write(cloudpickle.dumps(RunDict))
```
In b.py
```
import cloudpickle
with open("tmp.pickle", "rb") as f:
value = cloudpickle.load(f)
print(value)
```
```
λ python3.9 a.py
λ python3.9 b.py
.new_type at 0x1004580d0>
λ python3.10 a.py
λ python3.10 b.py
Traceback (most recent call last):
File "/Users/shantanu/devoai/openai/b.py", line 3, in
value = cloudpickle.load(f)
AttributeError: Can't get attribute 'RunDict' on
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.