grimen / python-attributedict

A dictionary object with attributes support - for Python.
https://pypi.org/project/attributedict
MIT License
17 stars 4 forks source link

AttributeDict could not pickle #8

Open Ledenel opened 4 years ago

Ledenel commented 4 years ago

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.

codecov[bot] commented 4 years ago

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.

Ledenel commented 4 years ago

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