[IronPython] Comparing enum to None

Martin Maly Martin.Maly at microsoft.com
Wed Dec 21 18:51:31 CET 2005


Thanks for the bug report, William, sending them to the alias is just fine.

Martin

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of William Reade
Sent: Wednesday, December 21, 2005 6:01 AM
To: Discussion of IronPython
Subject: [IronPython] Comparing enum to None

Hi, we have a bug report. The following code:

------------------------------------------------------------------
import sys
sys.LoadAssemblyByName("System.Windows.Forms")
from System.Windows.Forms import *

if 1 == None:
    print "won't happen"

if DialogResult.Cancel == None: # boom!
    print "won't happen"
------------------------------------------------------------------

...raises a NullReferenceException, as follows, at the marked line.

------------------------------------------------------------------
Unhandled Exception: System.NullReferenceException: Object reference not 
set to
an instance of an object.
   at IronPython.Objects.EnumOps.Equal(Object self, Object other)
   at IronPython.Objects.Ops.Equal(Object x, Object y)
   at __main__.Initialize() in H:\dev\current\sandbox\testenumnone.py:line 8
------------------------------------------------------------------

We feel the expression should just evaluate to False.

Incidentally, should we be bothering the list with these things, or 
should we put them directly into the bug tracker?

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