This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JosephArmbruster
Recipients JosephArmbruster, christian.heimes, loewis
Date 2007-11-28.16:25:07
SpamBayes Score 0.00052478095
Marked as misclassified No
Message-id <1196267109.95.0.653970377186.issue1513@psf.upfronthosting.co.za>
In-reply-to
Content
URL: http://svn.python.org/projects/python/branches/py3k
Rev: 59215

Session illustrating issue:

>>> a = None
[40667 refs]
>>> cmp(a,None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() < NoneType()
[40715 refs]

Resolution: It appears the equality comparison in do_compare should take
place first, otherwise a TypeError thwarts the desired comparison.

rt.bat Results (I can only test core, since I do not have the third
party libs here):

Failed tests before change:
  test_ctypes test_mailbox

Failed tests after change:
  test_copy test_ctypes test_mailbox

test_copy is failing because of this block:

    def test_deepcopy_reflexive_dict(self):
        x = {}
        x['foo'] = x
        y = copy.deepcopy(x)
        self.assertRaises(TypeError, cmp, y, x)
        self.assert_(y is not x)
        self.assert_(y['foo'] is y)
        self.assertEqual(len(y), 1)

A RuntimeError now occurs instead.

        self.assertRaises(RuntimeError, cmp, y, x)

Additional Patch Note:

If this is a valid patch, please add a comment prior to the code change
that indicates the EQ test is first for a good reason.
Files
File name Uploaded
noneEquality.patch JosephArmbruster, 2007-11-28.16:25:07
History
Date User Action Args
2007-11-28 16:25:10JosephArmbrustersetspambayes_score: 0.000524781 -> 0.00052478095
recipients: + JosephArmbruster, loewis, christian.heimes
2007-11-28 16:25:09JosephArmbrustersetspambayes_score: 0.000524781 -> 0.000524781
messageid: <1196267109.95.0.653970377186.issue1513@psf.upfronthosting.co.za>
2007-11-28 16:25:09JosephArmbrusterlinkissue1513 messages
2007-11-28 16:25:07JosephArmbrustercreate