summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-11-19 16:03:17 (GMT)
committerGuido van Rossum <guido@python.org>1997-11-19 16:03:17 (GMT)
commit242c64256c03f94e043a7528ff5b7e0220262d8d (patch)
treecf7926ca560c912fccd7107f68c424833ec3ace1 /Include
parent220ecc8c4b3891c1d6eb7e59f8e8b38ac706d25b (diff)
downloadcpython-242c64256c03f94e043a7528ff5b7e0220262d8d.zip
cpython-242c64256c03f94e043a7528ff5b7e0220262d8d.tar.gz
cpython-242c64256c03f94e043a7528ff5b7e0220262d8d.tar.bz2
Add a new function PyNumber_CoerceEx() which works just like
PyNumber_Coerce() except that when the coercion can't be done and no other exceptions happen, it returns 1 instead of raising an exception. Use this function in PyObject_Compare() to avoid raising an exception simply because two objects with numeric behavior can't be coerced to a common type; instead, proceed with the non-numeric default comparison. Note that this is a somewhat questionable practice -- comparisons for numeric objects shouldn't default to random behavior like this, but it is required for backward compatibility. (Case in point, it broke comparison of kjDict objects to integers in Aaron Watters' kjbuckets extension.) A correct fix (for python 2.0) should involve a different definiton of comparison altogether.
Diffstat (limited to 'Include')
0 files changed, 0 insertions, 0 deletions