[New-bugs-announce] [issue41049] PyObject_RichCompareBool(nan, nan, eq) can be True

tamuhey report at bugs.python.org
Sat Jun 20 05:20:57 EDT 2020

New submission from tamuhey <tamuhey at gmail.com>:

Applying PyObject_RichCompareBool to two `nan`s can be true if the two nans are same object, i.e.

a = float("nan")
PyObject_RichCompareBool(a, a, Py_EQ) // True

I read the document (https://docs.python.org/3/c-api/object.html?highlight=pyobject_richcomparebool#c.PyObject_RichCompareBool) and understood it is intended, but there should be gentle comment to tell users this behaviour.

components: C API
messages: 371927
nosy: tamuhey
priority: normal
severity: normal
status: open
title: PyObject_RichCompareBool(nan, nan, eq) can be True
type: enhancement
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list