Skip to content

Deprecate Py_IS_NAN/INFINITY/FINITE? #119613

Description

@skirpichev

Feature or enhancement

Proposal:

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.

JFR: #119457 (comment)

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. skirpichev commented on May 27, 2024

    @skirpichev
    MemberAuthor

    CC @vstinner as author of 194a952

    I'll work on a patch.

  2. added a commit that references this issue on May 27, 2024
  3. skirpichev commented on May 28, 2024

    @skirpichev
    MemberAuthor

    First part: #119619

  4. vstinner commented on May 28, 2024

    @vstinner
    Member

    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.

  5. skirpichev commented on May 28, 2024

    @skirpichev
    MemberAuthor

    @vstinner, these macroses were undocumented. Should we (1) document them (with "deprecated" statement) and (2) add news entry? Or (2) is enough?

    I would be fine with a soft deprecation.

    If we don't announce removal (e.g. deprecated-removed statement) wouldn't this be a soft deprecation?


  6. vstinner commented on May 28, 2024

    @vstinner
    Member

    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.

  7. skirpichev commented on May 28, 2024

    @skirpichev
    MemberAuthor

    Maybe this could go to 3.13?

  8. vstinner commented on May 28, 2024

    @vstinner
    Member

    Maybe this could go to 3.13?

    Deprecations cannot be added after beta1.

  9. added 2 commits that reference this issue on May 29, 2024
  10. skirpichev commented on May 29, 2024

    @skirpichev
    MemberAuthor

    Ok, last part: #119701

  11. added 2 commits that reference this issue on May 29, 2024
  12. added 3 commits that reference this issue on Jun 4, 2024
  13. added a commit that references this issue on Jun 5, 2024
  14. added 3 commits that reference this issue on Jul 11, 2024
  15. added 3 commits that reference this issue on Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions