[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.
|