[IronPython] int64/long incompatibility in dictionary lookup

Dino Viehland dinov at exchange.microsoft.com
Wed Aug 13 00:52:21 CEST 2008


I strongly suspect we'll fix this for the next release.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ronnie Maor
Sent: Tuesday, August 12, 2008 2:16 PM
To: Discussion of IronPython
Subject: Re: [IronPython] int64/long incompatibility in dictionary lookup

of course it's the hashing...
in my defense it's past my bed time, so not thinking very clearly :-)

we've changed the way we interact with NHibernate recently, and keep bumping into this issue now. The NHibernate domain objects are C# (NHibernate can't work with python objects), and we now cache them in some places by their Int64 IDs, so this happens a lot.

We can work around it by casting to long, but it's very error prone, since we need to do it in several places.

In short, would be very happy if you could unify the hashing for 2.0

thanks
On Tue, Aug 12, 2008 at 11:34 PM, Dino Viehland <dinov at exchange.microsoft.com<mailto:dinov at exchange.microsoft.com>> wrote:

I don't think it's a known issue - but it's because we don't have code that unifies the Int64's hashing w/ long's hashing though.  We should probably add that for a smoother .NET interop story.



I've filed this as CodePlex bug #17799 (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=17799).  Thanks for the report.



From: users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com> [mailto:users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com>] On Behalf Of Ronnie Maor
Sent: Tuesday, August 12, 2008 1:10 PM
To: Discussion of IronPython
Subject: [IronPython] int64/long incompatibility in dictionary lookup



Hi all,

is the following a known issue?

>>> x = System.Int64(8591464408876390743)
>>> y = long(x)
>>> x == y
True
>>> d = {x:3}
>>> d[x]
3
>>> d[y]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 8591464408876390743

happens in both IPy 1.1.2 and 2.0b4

thanks
Ronnie

________________________________
Sample disclaimer text

_______________________________________________
Users mailing list
Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


________________________________
Sample disclaimer text
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080812/564014d1/attachment.html>


More information about the Ironpython-users mailing list