• Tim Peters's avatar
    SF bug #513866: Float/long comparison anomaly. · 307fa781
    Tim Peters yazdı
    When an integer is compared to a float now, the int isn't coerced to float.
    This avoids spurious overflow exceptions and insane results.  This should
    compute correct results, without raising spurious exceptions, in all cases
    now -- although I expect that what happens when an int/long is compared to
    a NaN is still a platform accident.
    
    Note that we had potential problems here even with "short" ints, on boxes
    where sizeof(long)==8.  There's #ifdef'ed code here to handle that, but
    I can't test it as intended.  I tested it by changing the #ifdef to
    trigger on my 32-bit box instead.
    
    I suppose this is a bugfix candidate, but I won't backport it.  It's
    long-winded (for speed) and messy (because the problem is messy).  Note
    that this also depends on a previous 2.4 patch that introduced
    _Py_SwappedOp[] as an extern.
    307fa781
test_long.py 18.3 KB