cloudpipe / cloudpipe/cloudpickle

Support for pickling functions within a class defined outside of __main__?

オープン
#175 コメント 6 件 リアクション 2 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Python
スター
1.9k
フォーク
195
平均マージ
1日 10時間
マージ済み PR(30日)
1

説明

Cloudpickle's ability to serialize instantiated classes and their member functions is a huge advantage over cloudpickle alternatives. Unfortunately, this feature seems limited heavily to the check for `instantiated_class.__module__ == '__main__'`.

One hacky solution is to set `__module__` in the class definition:
```
class SomeFunClass(object):
__module__ = '__main__'

# Rest of the class definition
```

But this could cause problems with any code that relies on a proper value for `__module__`. Is there another solution I'm not seeing?

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

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

調査の方向性

ソースファイルもテストも指定されていません。まず instantiated_class.__module__ == '__main__' のチェックを見つけ、説明されているクラス/メンバー関数のケースを再現してください。__module__ の値を変更しなくても __main__ の外部で定義されたクラスをサポートできれば完了です。

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

評価

技術スタック
python
領域
tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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