[IronPython] Adding None to a set

Dino Viehland dinov at exchange.microsoft.com
Thu Jun 29 19:18:54 CEST 2006


Thanks for reporting this.

Luckily this one is quite easy to fix.  The reason for this bug is that .NET dictionaries don't allow null as a value, and the Set class used to be backed off of a .NET dictionary.  But these days it's backed by a Python dictionary, but there's still some checks to handle null values that seem to have lingered on.

If you remove every instance of:

            if (o == null) o = NoneType.InstanceOfNoneType;

from IronPython\Runtime\Set.cs then you'll get rid of this bug.

I'll file a CodePlex bug on this & get it fixed for the next release.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of William Reade
Sent: Thursday, June 29, 2006 7:15 AM
To: Discussion of IronPython
Subject: [IronPython] Adding None to a set

Hi guys

As if you didn't have enough on your plates already...

IronPython beta8:
 >>> st = set([])
 >>> st.add(None)
 >>> st
set([<type 'NoneType'>])

CPython:
 >>> st = set([])
 >>> st.add(None)
 >>> st
set([None])

Cheers
William
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list