[ python-Bugs-1633648 ] incomplete numerical comparisons
SourceForge.net
noreply at sourceforge.net
Wed Apr 11 18:55:54 CEST 2007
Bugs item #1633648, was opened at 2007-01-11 19:18
Message generated for change (Comment added) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1633648&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
>Priority: 6
Private: No
Submitted By: Matthias Klose (doko)
Assigned to: Nobody/Anonymous (nobody)
Summary: incomplete numerical comparisons
Initial Comment:
[forwarded from http://bugs.debian.org/334022]
bug submitter writes:
I've been tracking down the regression failure in python-pgsql under
python2.[45], and here's what it comes down to.
Python-pgsql includes a short int type named PgInt2, which allows itself
to be coerced into all of the usual numeric types.
The regression that fails is when a PgInt2 is compared with a float. In
this case python determines that the comparison is not implemented.
The problem is this:
- Under python2.[45], the float type includes tp_richcompare but not
tp_compare.
- When calling try_rich_to_3way_compare(), python does not try any kind
of numeric coercion, and so the comparison fails.
- When calling try_3way_compare(), python successfully coerces the
PgInt2 into a float, but then the comparison fails because the float
type has no tp_compare routine.
Presumably what would fix things would be one of the following:
- Bring back the trivial float_compare() routine, which was removed with
python2.[45] when they brought in the new float_richcompare() instead;
- In try_3way_compare(), if the coercion succeeds and neither object
has a tp_compare routine, try tp_richcompare before failing completely.
Does either of these solutions seem feasible?
Thanks - Ben.
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2007-04-11 11:55
Message:
Logged In: YES
user_id=80475
Originator: NO
Raising the priority so this report doesn't get lost.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1633648&group_id=5470
More information about the Python-bugs-list
mailing list