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 — _Py_c_sum, _Py_c_diff, etc - were removed from Python.h · Issue #112019 · python/cpython

_Py_c_sum, _Py_c_diff, etc - were removed from Python.h #112019

New issue
Copy link
New issue
Copy link
Closed
Closed
_Py_c_sum, _Py_c_diff, etc - were removed from Python.h#112019
Copy link
Labels
topic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@skirpichev
skirpichev
opened on Nov 13, 2023
Issue body actions

See #106339 and #106320. But these functions are documented as public: https://docs.python.org/3/c-api/complex.html#complex-numbers-as-c-structures

I think c38c666 should be partially reverted and _Py_c_abs - documented.

On another hand, quick github search shows very little examples of using above functions. See also #106320 (comment). So, in a long term I propose to deprecate this API and related functions (PyComplex_FromCComplex/PyComplex_AsCComplex). Who knows, maybe someday we could use <complex.h>...

Linked PRs

  • gh-112019: reversion of removal _Py_c_* functions in #106339 #112021
  • gh-112019: Add Py_complex_abs() function #112107

Activity

  1. skirpichev
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Nov 13, 2023
  2. skirpichev commented on Nov 13, 2023

    @skirpichev
    skirpichev
    on Nov 13, 2023
    MemberAuthor
    More actions

    CC @vstinner

  3. Eclips4
    added
    topic-C-API
    on Nov 13, 2023
  4. skirpichev
    added a commit that references this issue on Nov 13, 2023

    pythongh-112019: reversion of removal _Py_c_* functions in python#106339

    3c25afb
  5. vstinner commented on Nov 13, 2023

    @vstinner
    vstinner
    on Nov 13, 2023
    Member
    More actions

    If these functions are useful, I would prefer to make them public.

    Previous discussion about this private API: #106320 (comment)

  6. vstinner
    added 4 commits that reference this issue on Nov 15, 2023

    pythongh-112019: Add Py_complex_abs() function

    65c7cfe

    pythongh-112019: Add Py_complex_abs() function

    f56fe1c

    pythongh-112019: Add Py_complex_abs() function

    78842d7

    pythongh-112019: Add Py_complex_abs() function

    53ddec4
  7. vstinner commented on Nov 15, 2023

    @vstinner
    vstinner
    on Nov 15, 2023
    Member
    More actions

    @skirpichev: Do you use these functions? Do you know a project using these functions? A code search on PyPI top 5,000 projects only found 1 line using _Py_c_pow() in the numba project.

  8. skirpichev commented on Nov 15, 2023

    @skirpichev
    skirpichev
    on Nov 15, 2023
    MemberAuthor
    More actions

    @mdickinson, should we expose these functions and details of the Py_complex struct, what do you think?

    If these functions are useful, I would prefer to make them public.

    Code search shows they aren't used too much.

    @skirpichev: Do you use these functions?

    Not outside of CPython itself.

    PS: (I'm moving discussion from #106320)

    The C99 complex API is documented at: https://en.cppreference.com/w/c/numeric/complex

    It seems, see e.g. (https://discuss.python.org/t/33433/23, llvm/llvm-project#8904), that none of popular compilers (icc maybe an exception) support this extension correctly.

  9. vstinner commented on Nov 15, 2023

    @vstinner
    vstinner
    on Nov 15, 2023
    Member
    More actions

    @mdickinson, should we expose these functions and details of the Py_complex struct, what do you think?

    Members of the Py_complex structure are public since the structure was added to Python 1.4 by commit f9fca92 in 1996. The structure was called complex and then was renamed to Py_complex.

    The Py_complex functions are already documented but have a _Py prefix.

  10. skirpichev commented on Nov 15, 2023

    @skirpichev
    skirpichev
    on Nov 15, 2023
    MemberAuthor
    More actions

    Also they take struct by value, a bit strange API.

  11. vstinner commented on Nov 15, 2023

    @vstinner
    vstinner
    on Nov 15, 2023
    Member
    More actions

    I restored removed _Py_c complex functions in #112115. The initial issue is fixed, so I close the issue.

    Later, we should consider deprecating these functions and make them fully internal. I restored these functions because they are documented.

  12. vstinner
    closed this as completedon Nov 15, 2023
  13. skirpichev commented on Nov 16, 2023

    @skirpichev
    skirpichev
    on Nov 16, 2023
    MemberAuthor
    More actions

    Later, we should consider deprecating these functions and make them fully internal.

    Maybe we could keep this issue for that?

  14. vstinner commented on Nov 16, 2023

    @vstinner
    vstinner
    on Nov 16, 2023
    Member
    More actions

    Maybe we could keep this issue for that?

    I prefer to wait until a migration path is decision on how to get rid of private functions (which were reverted in Python 3.13. alpha2): capi-workgroup/api-evolution#24

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-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — 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.