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 fdrake
Recipients fdrake
Date 2008-09-10.20:32:34
SpamBayes Score 1.5275677e-09
Marked as misclassified No
Message-id <1221078780.65.0.750398332014.issue3829@psf.upfronthosting.co.za>
In-reply-to
Content
There's a strange condition where cmp() of tuples of unorderable values
returns -1 even though using the unorderable values raises an exception.

If I have these two unorderable values, cmp() raises an expected exception:

  >>> s0 = frozenset(['testing 0'])
  >>> s1 = frozenset(['testing 1'])
  >>> cmp(s0, s1)
  Traceback (most recent call last):
    File "<stdin>", line 1, in ?
  TypeError: cannot compare sets using cmp()

Comparing tuples of the values returns -1:

  >>> cmp((s0,), (s1,))
  -1

Py3k does raise a TypeError, but the message is indecipherable:

  >>> cmp((s0,), (s1,))
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: unorderable types: 'tuple' != 'tuple'

(The Py3k message for the set comparison is the same as for Python 2.)

I believe that this is an error; the exception from the underlying item
comparison should be propagated.
History
Date User Action Args
2008-09-10 20:33:00fdrakesetrecipients: + fdrake
2008-09-10 20:33:00fdrakesetmessageid: <1221078780.65.0.750398332014.issue3829@psf.upfronthosting.co.za>
2008-09-10 20:32:35fdrakelinkissue3829 messages
2008-09-10 20:32:34fdrakecreate