You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
isnan(), isinf() and isfinite() are part of C99, which is a requirement for 3.11+. Probably, it does make sense to deprecate (undocumented) public macros and switch codebase to use C stdlib functions.
isnan(), isinf() and isfinite() are part of C99, which is a requirement for 3.11+. Probably, it does make sense to deprecate (undocumented) public macros and switch codebase to use C stdlib functions.
A code search on PyPI top 7,500 projects found 10 projects using these macros:
Nuitka (2.1.2)
aim (3.19.1)
fastcluster (1.2.6)
gmpy2 (2.1.5)
msgspec (0.18.6)
numba (0.59.0)
pandas (2.2.1)
python-rapidjson (1.16)
simplejson (3.19.2)
vowpalwabbit (9.9.0)
I suggest to update all of these projects before considering to deprecate these macros.
I would be fine with a soft deprecation. It's the kind of the issue which fall into PEP 743 – Add Py_COMPAT_API_VERSION to the Python C API territory: having a way to opt-out from deprecated macros, without forcing all projects to update their code.
Activity
skirpichev commentedon May 27, 2024
CC @vstinner as author of 194a952
I'll work on a patch.
pythongh-119613: use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE
skirpichev commentedon May 28, 2024
First part: #119619
vstinner commentedon May 28, 2024
A code search on PyPI top 7,500 projects found 10 projects using these macros:
I suggest to update all of these projects before considering to deprecate these macros.
I would be fine with a soft deprecation. It's the kind of the issue which fall into PEP 743 – Add Py_COMPAT_API_VERSION to the Python C API territory: having a way to opt-out from deprecated macros, without forcing all projects to update their code.
skirpichev commentedon May 28, 2024
@vstinner, these macroses were undocumented. Should we (1) document them (with "deprecated" statement) and (2) add news entry? Or (2) is enough?
If we don't announce removal (e.g. deprecated-removed statement) wouldn't this be a soft deprecation?
vstinner commentedon May 28, 2024
You can announce the soft deprecation in What's New in Python 3.14 and add a comment to explain that these macros are soft deprecated.
skirpichev commentedon May 28, 2024
Maybe this could go to 3.13?
vstinner commentedon May 28, 2024
Deprecations cannot be added after beta1.
pythongh-119613: deprecate Py_IS_NAN/INFINITY and Py_IS_FINITE
pythongh-119613: deprecate Py_IS_NAN/INFINITY and Py_IS_FINITE
skirpichev commentedon May 29, 2024
Ok, last part: #119701
gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE (#…
gh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (#119701)
pythongh-119613: Soft deprecate Py_MEMCPY() macro
pythongh-119613: Soft deprecate the Py_MEMCPY() macro
gh-119613: Soft deprecate the Py_MEMCPY() macro (#120020)
pythongh-119613: Soft deprecate the Py_MEMCPY() macro (python#120020)
pythongh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FIN…
pythongh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (python#119701
pythongh-119613: Soft deprecate the Py_MEMCPY() macro (python#120020)
pythongh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FIN…
pythongh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (python#119701
pythongh-119613: Soft deprecate the Py_MEMCPY() macro (python#120020)