This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2021-10-11.23:51:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1633996280.11.0.993737910951.issue45440@roundup.psfhosted.org>
In-reply-to
Content
If the HAVE_DECL_ISINF macro is not defined in pyconfig.h, the Py_IS_INFINITY macro is defined as:

#define Py_IS_INFINITY(X) \
    ((X) && (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))

Problem: Py_FORCE_DOUBLE() is excluded from the limited C API (and the stable ABI).

I see different options:

* Implement Py_IS_INFINITY() as an opaque function if the HAVE_DECL_ISINF macro is not defined. I did something similar in Py_INCREF() to support the limited C API with a debug build of Python: call _Py_IncRef() opaque function.

* Make Py_FORCE_DOUBLE() private and add it to the limited C API as an implementation detail.

* Add Py_FORCE_DOUBLE() macro to the limited C API: the current implementation is fragile, it depends on how Python.h is included. Also, I dislike macros in the limited C API.

I would prefer to *remove* Py_FORCE_DOUBLE() to all APIs, than adding it to the limited C API.
History
Date User Action Args
2021-10-11 23:51:20vstinnersetrecipients: + vstinner
2021-10-11 23:51:20vstinnersetmessageid: <1633996280.11.0.993737910951.issue45440@roundup.psfhosted.org>
2021-10-11 23:51:20vstinnerlinkissue45440 messages
2021-10-11 23:51:19vstinnercreate