[IronPython] Comparing enum to None
William Reade
william at resolversystems.com
Wed Dec 21 15:01:00 CET 2005
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
More information about the Ironpython-users
mailing list