cloudpipe / cloudpipe/cloudpickle

Classes with `cached_property` can't be cloudpickled

Open
#438 3 comments 1 reaction 0 assignees View on GitHub
enhancement help wanted
Dominant language
Python
Stars
1.9k
Forks
195
Avg merge
1d 10h
Merged PRs (30d)
1

Description

I believe this is a bug.

Here is an example:

```py
from functools import cached_property
import pickle
import cloudpickle

class MyExample:
def __init__(self, foo):
self.foo = foo

@cached_property
def bar(self) -> int:
return self.foo * 3

example = MyExample(2)
pickle.dumps(example) # works
cloudpickle.dumps(example) # crashes
```

This fails with `TypeError: cannot pickle '_thread.RLock' object`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.