python-attributedict icon indicating copy to clipboard operation
python-attributedict copied to clipboard

AttributeDict could not pickle

Open Ledenel opened this issue 5 years ago • 2 comments

According to python pickle, object containing pickable object (Including AttributeDict) should pickle.

But AttributeDict implements __reduce__ which override the origin pickle process, and even call __reduce__ on __dict__ doesn't actually pickle a dict. Instead, it will throw TypeError: can't pickle dict objects even the __dict__ itself is pickable.

Ledenel avatar Mar 29 '20 13:03 Ledenel

Codecov Report

Merging #8 into master will increase coverage by 0.51%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #8      +/-   ##
==========================================
+ Coverage   89.03%   89.54%   +0.51%     
==========================================
  Files           3        3              
  Lines         155      153       -2     
==========================================
- Hits          138      137       -1     
+ Misses         17       16       -1     
Impacted Files Coverage Δ
attributedict/collections.py 87.87% <ø> (+0.56%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 26c69ad...fbb2c26. Read the comment docs.

codecov[bot] avatar Mar 29 '20 13:03 codecov[bot]

Add unittest to reproduce and simply remove reduce to fix it.

Ledenel avatar Mar 29 '20 14:03 Ledenel