This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alexandre.vassalotti
Recipients alexandre.vassalotti, benjamin.peterson, gvanrossum, hniksic, jcea, loewis, rhettinger
Date 2009-04-03.07:51:54
SpamBayes Score 3.411147e-05
Marked as misclassified No
Message-id <1238745117.35.0.184726311291.issue2389@psf.upfronthosting.co.za>
In-reply-to
Content
Ah, I just remembered the smart way I had devised some time ago to
handle this issue without changing the constructor of array.array. The
trick would be to add a __reduce__ method to array.array. This method
would return a special constructor function, the binary data of the
array and a string representing the format of the array.  Upon
unpickling, the special constructor function would be called with the
binary data and its format and then it would recreate the array.

Now, the only thing I am not sure about is whether this would work well
with subclasses of array.array. I guess we make __reduce__ also return
the instance's type which could be used by special constructor to
recreate the instance from the proper subclass.
History
Date User Action Args
2009-04-03 07:51:57alexandre.vassalottisetrecipients: + alexandre.vassalotti, gvanrossum, loewis, rhettinger, jcea, hniksic, benjamin.peterson
2009-04-03 07:51:57alexandre.vassalottisetmessageid: <1238745117.35.0.184726311291.issue2389@psf.upfronthosting.co.za>
2009-04-03 07:51:55alexandre.vassalottilinkissue2389 messages
2009-04-03 07:51:54alexandre.vassalotticreate