GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||
GeezerVison is showing github.com — gh-119613: deprecate Py_IS_NAN/INFINITY and Py_IS_FINITE by skirpichev · Pull Request #119701 · python/cpython Conversation
|
| ---------- | ||
|
|
||
| * Deprecate ``Py_IS_NAN``, ``Py_IS_INFINITY`` and ``Py_IS_FINITE`` macros, | ||
| use instead ``isnan``, ``isinf`` and ``isfinite`` available from ``<math.h>`` |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| use instead ``isnan``, ``isinf`` and ``isfinite`` available from ``<math.h>`` | |
| use instead :c:func:`!isnan`, :c:func:`!isinf` and :c:func:`!isfinite` available from :file:`math.h`. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actually, these are usually macros, e.g.:
https://en.cppreference.com/w/c/numeric/math/isinf
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sure; but this is about the markup :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Erlend E. Aasland <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to soft deprecate these macros, with a link to the glossary in thr What's New and Changelog entries (:term: syntax).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Victor Stinner <[email protected]>
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: Sergey B Kirpichev <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. IMO a soft deprecation is enough. Keeping these macros around is not a major maintenance burden.
If PEP 743 is accepted, maybe we can provide a way to remove this function with an opt-in option.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for the updates @skirpichev, I enabled automerge. @skirpichev: If you are interested, there are other macros which might be worth it to soft deprecate such as Py_MEMCPY(). I removed this macro in the limited C API version 3.11: #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 # define Py_MEMCPY memcpy #endif |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@vstinner, we can deprecate also |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
You can start by avoiding these macros in Python code base and see how it goes. Py_INFINITY and Py_NAN add a |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Hmm, from C11 Sec 7.2: "The macro INFINITY expands to a constant expression of type float representing positive or unsigned infinity, if available [...] The macro NAN is defined if and only if the implementation supports quiet NaNs for the float type. It expands to a constant expression of type float representing a quiet NaN." (c) As now build requirements include "Support for IEEE 754 floating point numbers and floating point Not-a-Number (NaN).", I think nowadays this type cast is useless. Yet, anyway, replacing (with a soft deprecation) Py_HUGE_VAL by Py_INFINITY - probably does make sense. I was mentioned in #104202 (comment). One obvious pro: current using both Py_HUGE_VAL and Py_INFINITY may confuse readers. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
) Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Erlend E. Aasland <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.