GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Deprecate Py_IS_NAN/INFINITY/FINITE? · Issue #119613 · python/cpython

Deprecate Py_IS_NAN/INFINITY/FINITE? #119613

New issue
Copy link
New issue
Copy link
Closed
Closed
Deprecate Py_IS_NAN/INFINITY/FINITE?#119613
Copy link
Labels
topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

Description

@skirpichev
skirpichev
opened on May 27, 2024
Issue body actions

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

  • gh-119613: use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE #119619
  • gh-119613: deprecate Py_IS_NAN/INFINITY and Py_IS_FINITE #119701
  • gh-119613: Soft deprecate the Py_MEMCPY() macro #120020

Activity

  1. skirpichev
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on May 27, 2024
  2. skirpichev commented on May 27, 2024

    @skirpichev
    skirpichev
    on May 27, 2024
    MemberAuthor
    More actions

    CC @vstinner as author of 194a952

    I'll work on a patch.

  3. Eclips4
    added
    topic-C-API
    on May 27, 2024
  4. skirpichev
    added a commit that references this issue on May 27, 2024

    pythongh-119613: use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE

    13dcd12
  5. skirpichev commented on May 28, 2024

    @skirpichev
    skirpichev
    on May 28, 2024
    MemberAuthor
    More actions

    First part: #119619

  6. vstinner commented on May 28, 2024

    @vstinner
    vstinner
    on May 28, 2024
    Member
    More actions

    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.

  7. skirpichev commented on May 28, 2024

    @skirpichev
    skirpichev
    on May 28, 2024
    MemberAuthor
    More actions

    @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?


    • Nuitka (2.1.2)
    • aim (3.19.1)
    • fastcluster (1.2.6)
    • gmpy2 (2.1.5) // Use C99+ math.h functions instead of Py_IS_NAN/INFINITY/FINITE gmpy2/gmpy2#485
    • msgspec (0.18.6)
    • numba (0.59.0)
    • pandas (2.2.1) // CLN: use isnan() instead of the Py_IS_NAN macro pandas-dev/pandas#58850
    • python-rapidjson (1.16)
    • simplejson (3.19.2)
    • vowpalwabbit (9.9.0)
  8. vstinner commented on May 28, 2024

    @vstinner
    vstinner
    on May 28, 2024
    Member
    More actions

    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.

  9. skirpichev commented on May 28, 2024

    @skirpichev
    skirpichev
    on May 28, 2024
    MemberAuthor
    More actions

    Maybe this could go to 3.13?

  10. vstinner commented on May 28, 2024

    @vstinner
    vstinner
    on May 28, 2024
    Member
    More actions

    Maybe this could go to 3.13?

    Deprecations cannot be added after beta1.

    Reacted by Alex Waygood, Eric V. Smith, Erlend E. Aasland and Sergey B Kirpichev
  11. skirpichev
    added 2 commits that reference this issue on May 29, 2024

    pythongh-119613: deprecate Py_IS_NAN/INFINITY and Py_IS_FINITE

    5070e5c

    pythongh-119613: deprecate Py_IS_NAN/INFINITY and Py_IS_FINITE

    e7696ba
  12. skirpichev commented on May 29, 2024

    @skirpichev
    skirpichev
    on May 29, 2024
    MemberAuthor
    More actions

    Ok, last part: #119701

  13. vstinner
    added 2 commits that reference this issue on May 29, 2024

    gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE (#…

    cd11ff1

    gh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (#119701)

    0cdc5c8
  14. vstinner
    closed this as completedon May 29, 2024
  15. vstinner
    added 3 commits that reference this issue on Jun 4, 2024

    pythongh-119613: Soft deprecate Py_MEMCPY() macro

    d83c6dc

    pythongh-119613: Soft deprecate the Py_MEMCPY() macro

    a1c06f2

    gh-119613: Soft deprecate the Py_MEMCPY() macro (#120020)

    26e5c6e
  16. barneygale
    added a commit that references this issue on Jun 5, 2024

    pythongh-119613: Soft deprecate the Py_MEMCPY() macro (python#120020)

    1f2c6eb
  17. estyxx
    added 3 commits that reference this issue on Jul 17, 2024

    pythongh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FIN…

    6153c61

    pythongh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (python#119701

    173db92

    pythongh-119613: Soft deprecate the Py_MEMCPY() macro (python#120020)

    645f3a8
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

    topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.