durusmail: durus-users: Pickling/exporting objects
Pickling/exporting objects
2005-03-02
2005-03-02
2005-03-02
2005-03-02
2005-03-02
2005-03-02
2005-03-02
2005-03-03
2005-03-03
2005-03-03
2005-03-03
2005-03-03
2005-03-04
2005-03-04
2005-03-04
2005-03-04
2005-03-04
2005-03-04
2005-03-05
Pickling/exporting objects
David Binger
2005-03-04
This patch seems to make the pickling work.  Please verify.

Index: _persistent.c
===================================================================
--- _persistent.c       (revision 26269)
+++ _persistent.c       (working copy)
@@ -132,7 +132,7 @@
  static PyTypeObject Persistent_Type = {
      PyObject_HEAD_INIT(0)
      0,                                 /* ob_size */
-    "_persistent.PersistentBase",      /* tp_name */
+    "PersistentBase",  /* tp_name */
      sizeof(PersistentObject),          /* tp_basicsize */
      0,                                 /* tp_itemsize */
      0,                                 /* tp_dealloc */


On Mar 3, 2005, at 3:15 PM, Michael Watkins wrote:

>> On Thu, Mar 03, 2005 at 02:55:42PM -0500, Neil Schemenauer wrote:
>> s = pickle.dumps(c)
>
> In case this is useful, Python 2.4 gives a similar traceback with a
> possible clue:
>
>>>> s = pickle.dumps(c)
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "/usr/local/lib/python2.4/pickle.py", line 1386, in dumps
>     Pickler(file, protocol, bin).dump(obj)
>   File "/usr/local/lib/python2.4/pickle.py", line 231, in dump
>     self.save(obj)
>   File "/usr/local/lib/python2.4/pickle.py", line 338, in save
>     self.save_reduce(obj=obj, *rv)
>   File "/usr/local/lib/python2.4/pickle.py", line 415, in save_reduce
>     save(args)
>   File "/usr/local/lib/python2.4/pickle.py", line 293, in save
>     f(self, obj) # Call unbound method with explicit self
>   File "/usr/local/lib/python2.4/pickle.py", line 576, in save_tuple
>     save(element)
>   File "/usr/local/lib/python2.4/pickle.py", line 293, in save
>     f(self, obj) # Call unbound method with explicit self
>   File "/usr/local/lib/python2.4/pickle.py", line 760, in save_global
>     raise PicklingError(
> pickle.PicklingError: Can't pickle :
> it's not found as _persistent.PersistentBase
>
> _______________________________________________
> Durus-users mailing list
> Durus-users@mems-exchange.org
> http://mail.mems-exchange.org/mailman/listinfo/durus-users


reply