[IronPython] pickling python types

Ronnie Maor ronnie.maor at gmail.com
Wed Mar 24 19:19:40 CET 2010


Don't mean to nag, but it seems the original email was somehow overlooked.
We think it's a bug in 2.6.0

On Mon, Mar 22, 2010 at 1:53 PM, Ronnie Maor <ronnie.maor at gmail.com> wrote:

> Just a clarification - the GetPythonType below is superfluous
> pickle.dumps(Int64) fails the same way
>
> seems that all python types that aren't native (i.e. shadow an existing CLR
> type) fail that way.
> Pickling the CLR type (RuntimeType) actually works.
>
> On Mon, Mar 22, 2010 at 9:13 AM, Idan Zaltzberg <idan at cloudshare.com>wrote:
>
>>  Hi,
>>
>> I tried running the following code and got an exception (Ipy 2.6 final):
>>
>>
>>
>> import clr
>>
>> from System import Int64
>>
>> pickle.dumps(clr.GetPythonType(Int64))
>>
>>
>>
>> *throws:*
>>
>> Traceback (most recent call last):
>>
>>   File "<stdin>", line 1, in <module>
>>
>>   File "C:\systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 1366, in
>> dumps
>>
>>   File "C:\systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 224, in
>> dump
>>
>>   File "C:\systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 286, in
>> save
>>
>>   File "C:\systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 746, in
>> save_global
>>
>> pickle.PicklingError: Can't pickle <type 'Int64'>: it's not found as
>> System in mscorlib, Version=2.0.0.0, Culture=neutral,
>> PublicKeyToken=b77a5c561934e089.Int64
>>
>>
>>
>> Is this a bug?
>>
>> Currently my workaround is to pickle the CS type and convert it to a
>> python type after unpickling, please tell me if there is a better way.
>>
>> Thanks.
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100324/27b55799/attachment.html>


More information about the Ironpython-users mailing list