zf8848 / protobuf

Automatically exported from code.google.com/p/protobuf
Other
0 stars 0 forks source link

Python message objects are unpickleable #418

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the following
import pickle
from something_pb2 import AProtobufMessage

m = AProtobufMessage()
pickle.dump(m)

What is the expected output? What do you see instead?

The message is unpickleable.

Please use labels and text to provide additional information.

Pickle used by many python libraries for IPC, and not rewriting those libraries 
is a good thing. Also, supporting pickle is as simple as adding __getstate__ 
and __setstate__. The fork below accomplishes this goal:

https://github.com/Livefyre/protobuf/commit/2938cde2b7b15225fee85eac21a5cbb4c885
ba18

Original issue reported on code.google.com by n...@livefyre.com on 14 Sep 2012 at 5:33

GoogleCodeExporter commented 9 years ago
This will be fixed in the next release, 2.5.0, which is in progress. The change 
was unfortunately made just after the 2.4.1 release was cut.

Original comment by jas...@google.com on 19 Sep 2012 at 5:19

GoogleCodeExporter commented 9 years ago

Original comment by xiaof...@google.com on 19 Sep 2012 at 5:32

GoogleCodeExporter commented 9 years ago
Fixed in r425.

Original comment by xiaof...@google.com on 4 Dec 2012 at 10:37