[issue41049] PyObject_RichCompareBool(nan, nan, eq) can be True

2020-06-20 Thread tamuhey


New submission from tamuhey :

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 
<https://bugs.python.org/issue41049>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41049] Document pointer comparison in PyObject_RichCompareBool()

2020-06-20 Thread tamuhey


tamuhey  added the comment:

> Hmm, I missed it.  There is already a note in the link you provided

I've read the comment before posting this issue.
But I think there should be the following info:

1. example (float("nan"))
2. the result is inconsistent with PyObject_RichCompare

--

___
Python tracker 
<https://bugs.python.org/issue41049>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com