ReadOnlyDict/List pickle compatibility and serialization tests#737
ReadOnlyDict/List pickle compatibility and serialization tests#737thequilo merged 13 commits intoIDSIA:masterfrom
Conversation
|
CI is outputting |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
And an item open for discussion that I already mentioned in #770: Should we make the pickled type a read-only container or |
|
The configuration for checks on OSX was updated on the master branch. They should pass after you merge the master into your PR. |
As far as I know, are the read only types introduced to prevent accidental modifications of the config should work, because it is obvious that the user took care to not change the global config. |
Yes, that's right. The question is if we want to allow config = pickle.loads(pickle.dumps(config))
config[...] = ...In most cases that I can imagine, we want to lose the read-only properties when pickling (e.g., when saving to disk), but in some scenarios (e.g., multiprocessing, ray-tune) it might be safer to keep the read-only status. |
|
Having ReadOnlyDict pickled as As @thequilo alluded to in this comment, I think it's better to have the user make a copy first to |
|
@shwang Thank you! |
Makes ReadOnly{Dict,List} picklable. Also adds tests for pickle, json serialization.
The main changes to the read-only custom types were adding a
__reduce__method and simplifying the various__init__calls a bit by using using explicitclass.__init__calls rather thansuper().__init__(h/t @Qwlouse #508 (comment) ).Closes #499. Closes #738.