Skip to content

AttributeDict could not pickle #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Ledenel
Copy link

@Ledenel Ledenel commented Mar 29, 2020

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
Copy link

codecov bot commented Mar 29, 2020

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%) ⬆️

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
Copy link
Author

Ledenel commented Mar 29, 2020

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

@Ledenel Ledenel changed the title [WIP] AttributeDict could not pickle AttributeDict could not pickle Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant