register_pickle_by_value appears to not deliver monkeypatches to receiver
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start by reproducing the two-environment example around register_pickle_by_value(), cloudpickle.dumps(), and pickle.loads(), comparing the behavior of the patched tdb.my_function on both sides. Trace how the lambda and the tdb module reference are represented and resolved, then document whether the observed result is expected or identify the smallest failing behavior to test.
Written by the indexing model from the issue text.
Description
Should I expect register_pickle_by_value() to deliver monkeypatches? I don't know if what I'm observing is a bug or only missing functionality.
I have two python environments, A and B. Each has cloudpickle 3.1.2 installed and also a package that I'm developing at work. Let's call it "tdb". I run a script in environment A that looks like this:
import sys
import cloudpickle
import tdb
# monkeypatch an attribute of tdb.
tdb.my_function = lambda *args, **kwargs: ["fake", "values"]
def func():
return tdb.my_function()
assert func() == ["fake", "values"]
cloudpickle.register_pickle_by_value(tdb)
pickle_data = cloudpickle.dumps(func, protocol=4)
sys.stdout.buffer.write(pickle_data)
I'm piping the output to a script that runs in environment B
import pickle
import sys
pickle_data = sys.stdin.buffer.read()
print(pickle_data)
func = pickle.loads(pickle_data)
print(func())
But I see the original tdb.my_function being called in environment B, not my monkeypatch.
The odd thing is that I can see lambda when I print the pickle stream in environment B. It's there in some sense, but isn't being understood on the receiver side.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 197
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudpipe/cloudpickle
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudpipe/cloudpickle#593 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
cloudpipe/cloudpickle#595 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
cloudpipe/cloudpickle#592 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
cloudpipe/cloudpickle#589 ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
cloudpipe/cloudpickle#587 ·
All issues in cloudpipe/cloudpickle
Similar issues
-
agent-ready documentation needs-triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
instance instance add
Difficulty 1/5 Under an hour Newbie friendliness 72/100
searxng/searx-instances#939 · 1 comment ·
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100