Created
September 8, 2014 16:35
-
-
Save andresriancho/8015f5b92b6769fd9c9e to your computer and use it in GitHub Desktop.
Python cPickle bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cPickle | |
| import Cookie | |
| c = Cookie.SimpleCookie() | |
| c['abc'] = 'def' | |
| unpickled_highest = cPickle.loads(cPickle.dumps(c, cPickle.HIGHEST_PROTOCOL)) | |
| unpickled_default = cPickle.loads(cPickle.dumps(c)) | |
| print "c['abc'].value ", c['abc'].value | |
| print "unpickled_default['abc'].value", unpickled_default['abc'].value | |
| print "unpickled_highest['abc'].value", unpickled_highest['abc'].value | |
| assert unpickled_default['abc'].value == c['abc'].value | |
| assert unpickled_highest['abc'].value == c['abc'].value |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ugly, generic fix: