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
{{ message }}
Repository navigation
_Py_c_sum, _Py_c_diff, etc - were removed from Python.h #112019
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>...
@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.
@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.
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
Activity
skirpichev commentedon Nov 13, 2023
CC @vstinner
pythongh-112019: reversion of removal _Py_c_* functions in python#106339
vstinner commentedon Nov 13, 2023
If these functions are useful, I would prefer to make them public.
Previous discussion about this private API: #106320 (comment)
pythongh-112019: Add Py_complex_abs() function
pythongh-112019: Add Py_complex_abs() function
pythongh-112019: Add Py_complex_abs() function
pythongh-112019: Add Py_complex_abs() function
vstinner commentedon Nov 15, 2023
@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.skirpichev commentedon Nov 15, 2023
@mdickinson, should we expose these functions and details of the Py_complex struct, what do you think?
Code search shows they aren't used too much.
Not outside of CPython itself.
PS: (I'm moving discussion from #106320)
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.
vstinner commentedon Nov 15, 2023
Members of the
Py_complexstructure are public since the structure was added to Python 1.4 by commit f9fca92 in 1996. The structure was calledcomplexand then was renamed toPy_complex.The
Py_complexfunctions are already documented but have a_Pyprefix.skirpichev commentedon Nov 15, 2023
Also they take struct by value, a bit strange API.
vstinner commentedon Nov 15, 2023
I restored removed
_Py_ccomplex 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.
skirpichev commentedon Nov 16, 2023
Maybe we could keep this issue for that?
vstinner commentedon Nov 16, 2023
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