Yeah sorry for missing this and thanks for making sure we don't drop it.  I 
would agree that this is a bug.  I guess Int64.__module__ should really just be 
"System" and in general we shouldn't include the assembly name in the 
__module__ for built-in types.  That makes it slightly less useful to read but 
more useful for programmatic use.  Maybe we could add a new __assembly__ 
attribute to be more friendly to people.

If you don't open a bug on CodePlex I will.

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Ronnie Maor
Sent: Wednesday, March 24, 2010 11:20 AM
To: Discussion of IronPython
Subject: Re: [IronPython] pickling python types

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.m...@gmail.com<mailto:ronnie.m...@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 
<i...@cloudshare.com<mailto:i...@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@lists.ironpython.com<mailto:Users@lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to