[issue6431] Fraction fails equality test with a user-defined type

Mark Dickinson report at bugs.python.org
Thu Jul 16 20:34:33 CEST 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

Thanks again, casevh!  The patch looks good.  I've added to it a bit,
though---see issue6431.patch.  In detail:

- don't use subtraction with unknown types for <, <=, >, >=;  this is
  dangerous, since the unknown type may well do a lossy conversion, and
  comparisons should really be exact where possible;  as with __eq__,
  it seems better to return NotImplemented and give the other type a
  chance.

- handle infs and nans correctly in comparisons with floats

- a few more tests.

casevh, please could you have a look at the attached patch and let me
know whether it still works with your gmpy port?

Jeffrey, any comments on these changes?

----------
stage: test needed -> patch review
Added file: http://bugs.python.org/file14508/issue6431.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6431>
_______________________________________


More information about the Python-bugs-list mailing list