Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

register_pickle_by_value appears to not deliver monkeypatches to receiver

オープン
#586 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
tooling

調査の方向性

まず、register_pickle_by_value()、cloudpickle.dumps()、pickle.loads() を使用する2環境の例を再現し、両側でパッチを適用した tdb.my_function の動作を比較します。lambda と tdb モジュールへの参照がどのように表現され、解決されるかを追跡し、そのうえで観測された結果が期待どおりかどうかを記録するか、テストすべき最小限の失敗する動作を特定します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
1.9k
フォーク
197
平均マージ
1日 10時間
マージ済み PR(30日)
1

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cloudpipe/cloudpickle のほかの issue

cloudpipe/cloudpickle の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。