Created
December 9, 2014 17:54
-
-
Save ironpythonbot/5991bea58d67bd5a5269 to your computer and use it in GitHub Desktop.
CodePlex Issue #30805 Plain Text Attachments
This file contains 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 pickle | |
class MyClass(object): | |
pass | |
def test(obj): | |
# add a custom attribute | |
obj.some_attribute=42 | |
print "reduce=",obj.__reduce__() # doesn't include the attribute... | |
o=pickle.loads(pickle.dumps(obj, protocol=pickle.HIGHEST_PROTOCOL)) | |
print "some_attribute=",o.some_attribute # crashes with AttributeError... | |
print "test with MyClass..." | |
test(MyClass()) | |
print "test with Exception..." | |
test(Exception("some exception")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment