[IronPython] Adding None to a set

Dino Viehland dinov at exchange.microsoft.com
Thu Jun 29 10:24:45 PDT 2006


Well, I take that back...  that should fix it, but there's another bug which causes None to show up as an object :)  That involves fixing Dict, which is a little more involved, but is still the right thing to do.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
Sent: Thursday, June 29, 2006 10:19 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Adding None to a set

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
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


More information about the users mailing list