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 — C API: Remove private functions from abstract.h · Issue #106084 · python/cpython

C API: Remove private functions from abstract.h #106084

New issue
Copy link
New issue
Copy link
Closed
Closed
C API: Remove private functions from abstract.h#106084
Copy link
Labels
topic-C-API

Description

@vstinner
vstinner
opened on Jun 25, 2023
Issue body actions

Over the years, we accumulated many private functions as part of the public C API in abstract.h header file. I propose to remove them: move them to the internal C API.

Linked PRs

  • gh-106084: Remove old PyObject call aliases #106085
  • gh-106084: Remove _PySequence_BytesToCharpArray() function #106088
  • gh-106084: Remove _PyObject_HasLen() function #106103
  • gh-106084: Remove _PyObject_RealIsInstance() function #106106
  • gh-106084: Remove _PyObject_CallMethod() function #106159
Reacted by littlebutt's workshop

Activity

  1. vstinner
    added
    topic-C-API
    on Jun 25, 2023
  2. vstinner
    added 16 commits that reference this issue on Jun 25, 2023

    pythongh-106084: Remove old PyObject call aliases

    602e5cf

    pythongh-106084: Remove old PyObject call aliases

    a4c6cea

    pythongh-106084: Remove old PyObject call aliases

    f5b1f92

    pythongh-106084: Remove _PySequence_BytesToCharpArray() function

    fda911e

    pythongh-106084: Remove _PySequence_BytesToCharpArray() function

    62a11ff

    pythongh-106084: Remove _PySequence_BytesToCharpArray() function

    63d636f

    gh-106084: Remove old PyObject call aliases (#106085)

    00e75a3

    gh-106084: Remove _PySequence_BytesToCharpArray() function (#106088)

    7ca8716

    pythongh-106084: Remove _PyObject_HasLen() function

    2904095

    gh-106084: Remove _PyObject_HasLen() function (#106103)

    6200aaf

    pythongh-106084: Remove _PyObject_RealIsInstance() function

    83bf82d

    gh-106084: Remove _PyObject_RealIsInstance() function (#106106)

    e8e59ee

    pythongh-106084: Remove _PyObject_CallMethod() function

    c71994e

    pythongh-106084: Remove _PyObject_CallMethod() function

    12b900f

    pythongh-106084: Remove _PyObject_CallMethod() function

    a26ffa6

    gh-106084: Remove _PyObject_CallMethod() function (#106159)

    84caa33
  3. vstinner
    closed this as completedon Jun 27, 2023
  4. encukou commented on Jun 30, 2023

    @encukou
    encukou
    on Jun 30, 2023
    Member
    More actions

    Can we keep _PyObject_Vectorcall and such?
    The underscore served the same purpose as today's unstable API, and so i think we should follow that process:

    The old name should remain available until the new public name is deprecated or removed. There’s no need to deprecate the old name (it was unstable to begin with), but there’s also no need to break working code just because some function is now ready for a wider audience.

    The #define is not a big maintenance burden, and there's no reason to punish early adopters or people who want easier compatibility with 3.8.

  5. encukou
    reopened this on Jun 30, 2023
  6. vstinner commented on Jun 30, 2023

    @vstinner
    vstinner
    on Jun 30, 2023
    MemberAuthor
    More actions

    I would like to reduce the size of the C API. Aliases are causing a maintenance burden:

    • Users have to decide which API is the "good one"
    • Old APIs may have to be documented and tested (these aliases are in the docs)
    • Other Python implementations have to implement it just because some C extensions use them: not all Python implementations can implement aliases with #define.
    • Macros are not available in C extensions which don't use the header file but use directly symbols: macros are bad, see https://peps.python.org/pep-0670/

    A minority of project still refer to these old aliases. A code search on PyPI top 5,000 projects find matches in 8 projects:

    • debugpy (1.6.7)
    • iteration_utilities (0.11.0)
    • mypy (1.2.0)
    • orjson (3.8.10)
    • ptvsd (4.3.2)
    • pydevd (2.9.5)
    • scipy (1.10.1)
    • time-machine (2.9.0)
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/_uarray_dispatch.cxx: py_ref::steal(Q_PyObject_Vectorcall(cls, nullptr, 0, nullptr));
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/_uarray_dispatch.cxx: auto res = py_ref::steal(Q_PyObject_VectorcallMethod(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/_uarray_dispatch.cxx: res = py_ref::steal(Q_PyObject_Vectorcall(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/_uarray_dispatch.cxx: result = py_ref::steal(Q_PyObject_VectorcallMethod(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/_uarray_dispatch.cxx: py_ref ref = py_ref::steal(Q_PyObject_Vectorcall(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/_uarray_dispatch.cxx: auto res = py_ref::steal(Q_PyObject_VectorcallMethod(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.cxx: PyObject * Q_PyObject_Vectorcall(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.cxx: PyObject * ret = Q_PyObject_VectorcallDict(callable, args, nargs, dict);
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.cxx: return _PyObject_Vectorcall(callable, args, nargsf, kwnames);
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.cxx: PyObject * Q_PyObject_VectorcallDict(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.cxx: return _PyObject_FastCallDict(callable, (PyObject **)args, nargs, kwdict);
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.cxx: PyObject * Q_PyObject_VectorcallMethod(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.cxx: Q_PyObject_Vectorcall(callable, &args[1], nargsf - 1, kwnames);
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.cxx: PyObject * result = Q_PyObject_Vectorcall(callable, args, nargsf, kwnames);
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.h: PyObject * Q_PyObject_Vectorcall(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.h: PyObject * Q_PyObject_VectorcallDict(
    PYPI-2023-04-13/scipy-1.10.1.tar.gz: scipy-1.10.1/scipy/_lib/_uarray/vectorcall.h: PyObject * Q_PyObject_VectorcallMethod(
    
    PYPI-2023-04-13/debugpy-1.6.7.zip: debugpy-1.6.7/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_custom_pyeval_settrace_common.hpp: _PyObject_FastCallDict* pyObject_FastCallDict;
    PYPI-2023-04-13/debugpy-1.6.7.zip: debugpy-1.6.7/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_settrace.hpp: DEFINE_PROC_NO_CHECK(pyObject_FastCallDict, _PyObject_FastCallDict*, "_PyObject_FastCallDict", 530);
    PYPI-2023-04-13/debugpy-1.6.7.zip: debugpy-1.6.7/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_settrace.hpp: DEFINE_PROC_NO_CHECK(pyObject_FastCallDict, _PyObject_FastCallDict*, "PyObject_VectorcallDict", 533);
    PYPI-2023-04-13/debugpy-1.6.7.zip: debugpy-1.6.7/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_settrace.hpp: pyObject_FastCallDict = reinterpret_cast<_PyObject_FastCallDict*>(&PyObject_FastCallDictCustom);
    PYPI-2023-04-13/debugpy-1.6.7.zip: debugpy-1.6.7/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_utils.hpp: typedef PyObject * (_PyObject_FastCallDict)(
    
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/lib-rt/pythonsupport.h: result = _PyObject_FastCallDict(func, NULL, 0, kwds);
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/primitives/generic_ops.py: c_function_name="_PyObject_Vectorcall",
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r7 = _PyObject_Vectorcall(r4, r6, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r8 = _PyObject_Vectorcall(r5, r7, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r10 = _PyObject_Vectorcall(r7, r9, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r9 = _PyObject_Vectorcall(r6, r8, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r6 = _PyObject_Vectorcall(r3, r5, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r7 = _PyObject_Vectorcall(r4, r6, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r15 = _PyObject_Vectorcall(r12, r14, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r7 = _PyObject_Vectorcall(r4, r6, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r16 = _PyObject_Vectorcall(r13, r15, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r24 = _PyObject_Vectorcall(r21, r23, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r7 = _PyObject_Vectorcall(r4, r6, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r9 = _PyObject_Vectorcall(r6, r8, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r19 = _PyObject_Vectorcall(r16, r18, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r29 = _PyObject_Vectorcall(r26, r28, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r10 = _PyObject_Vectorcall(r7, r9, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r7 = _PyObject_Vectorcall(r4, r6, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r9 = _PyObject_Vectorcall(r6, r8, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r9 = _PyObject_Vectorcall(r5, r8, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r31 = _PyObject_Vectorcall(r28, r30, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r31 = _PyObject_Vectorcall(r28, r30, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r22 = _PyObject_Vectorcall(r19, r21, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r25 = _PyObject_Vectorcall(r22, r24, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r13 = _PyObject_Vectorcall(r10, r12, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r8 = _PyObject_Vectorcall(r5, r7, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r17 = _PyObject_Vectorcall(r14, r16, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r9 = _PyObject_Vectorcall(r6, r8, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r20 = _PyObject_Vectorcall(r17, r19, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r11 = _PyObject_Vectorcall(r8, r10, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r23 = _PyObject_Vectorcall(r20, r22, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r23 = _PyObject_Vectorcall(r20, r22, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r25 = _PyObject_Vectorcall(r22, r24, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r26 = _PyObject_Vectorcall(r23, r25, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r27 = _PyObject_Vectorcall(r24, r26, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r9 = _PyObject_Vectorcall(r6, r8, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-match.test: r13 = _PyObject_Vectorcall(r10, r12, 1, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-vectorcall.test: r0 = _PyObject_Vectorcall(c, 0, 0, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-vectorcall.test: r5 = _PyObject_Vectorcall(c, r4, 2, 0)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-vectorcall.test: r4 = _PyObject_Vectorcall(c, r2, 0, r3)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-vectorcall.test: r11 = _PyObject_Vectorcall(c, r9, 1, r10)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/irbuild-vectorcall.test: r10 = _PyObject_Vectorcall(r6, r8, 1, r9)
    PYPI-2023-04-13/mypy-1.2.0.tar.gz: mypy-1.2.0/mypyc/test-data/refcount.test: r3 = _PyObject_Vectorcall(f, r2, 1, 0)
    
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/local_dependencies/pyo3-ffi/src/cpython/abstract_.rs: pub unsafe fn _PyObject_VectorcallTstate(
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/local_dependencies/pyo3-ffi/src/cpython/abstract_.rs: _PyObject_VectorcallTstate(PyThreadState_GET(), callable, args, nargsf, kwnames)
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/local_dependencies/pyo3-ffi/src/cpython/abstract_.rs: #[cfg_attr(all(not(PyPy), not(Py_3_9)), link_name = "_PyObject_VectorcallDict")]
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/local_dependencies/pyo3-ffi/src/cpython/abstract_.rs: _PyObject_VectorcallTstate(tstate, func, args, nargs as size_t, std::ptr::null_mut())
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/local_dependencies/pyo3-ffi/src/cpython/abstract_.rs: _PyObject_VectorcallTstate(
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/local_dependencies/pyo3-ffi/src/cpython/abstract_.rs: _PyObject_VectorcallTstate(tstate, func, args, nargsf as size_t, std::ptr::null_mut())
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/include/pyo3/pyo3-ffi/src/cpython/abstract_.rs: pub unsafe fn _PyObject_VectorcallTstate(
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/include/pyo3/pyo3-ffi/src/cpython/abstract_.rs: _PyObject_VectorcallTstate(PyThreadState_GET(), callable, args, nargsf, kwnames)
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/include/pyo3/pyo3-ffi/src/cpython/abstract_.rs: #[cfg_attr(all(not(PyPy), not(Py_3_9)), link_name = "_PyObject_VectorcallDict")]
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/include/pyo3/pyo3-ffi/src/cpython/abstract_.rs: _PyObject_VectorcallTstate(tstate, func, args, nargs as size_t, std::ptr::null_mut())
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/include/pyo3/pyo3-ffi/src/cpython/abstract_.rs: _PyObject_VectorcallTstate(
    PYPI-2023-04-13/orjson-3.8.10.tar.gz: orjson-3.8.10/include/pyo3/pyo3-ffi/src/cpython/abstract_.rs: _PyObject_VectorcallTstate(tstate, func, args, nargsf as size_t, std::ptr::null_mut())
    
    PYPI-2023-04-13/pydevd-2.9.5.tar.gz: pydevd-2.9.5/pydevd_attach_to_process/common/py_custom_pyeval_settrace_common.hpp: _PyObject_FastCallDict* pyObject_FastCallDict;
    PYPI-2023-04-13/pydevd-2.9.5.tar.gz: pydevd-2.9.5/pydevd_attach_to_process/common/py_settrace.hpp: DEFINE_PROC_NO_CHECK(pyObject_FastCallDict, _PyObject_FastCallDict*, "_PyObject_FastCallDict", 530);
    PYPI-2023-04-13/pydevd-2.9.5.tar.gz: pydevd-2.9.5/pydevd_attach_to_process/common/py_settrace.hpp: DEFINE_PROC_NO_CHECK(pyObject_FastCallDict, _PyObject_FastCallDict*, "PyObject_VectorcallDict", 533);
    PYPI-2023-04-13/pydevd-2.9.5.tar.gz: pydevd-2.9.5/pydevd_attach_to_process/common/py_settrace.hpp: pyObject_FastCallDict = reinterpret_cast<_PyObject_FastCallDict*>(&PyObject_FastCallDictCustom);
    PYPI-2023-04-13/pydevd-2.9.5.tar.gz: pydevd-2.9.5/pydevd_attach_to_process/common/py_utils.hpp: typedef PyObject * (_PyObject_FastCallDict)(
    
    PYPI-2023-04-13/ptvsd-4.3.2.zip: ptvsd-4.3.2/src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/common/py_settrace.hpp: DEFINE_PROC(pyObject_FastCallDict, _PyObject_FastCallDict*, "_PyObject_FastCallDict", 530);
    PYPI-2023-04-13/ptvsd-4.3.2.zip: ptvsd-4.3.2/src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/common/py_settrace_37.hpp: _PyObject_FastCallDict* pyObject_FastCallDict;
    PYPI-2023-04-13/ptvsd-4.3.2.zip: ptvsd-4.3.2/src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/common/py_utils.hpp: typedef PyObject * (_PyObject_FastCallDict)(
    
    PYPI-2023-04-13/time-machine-2.9.0.tar.gz: time-machine-2.9.0/src/_time_machine.c: result = _PyObject_Vectorcall(time_machine_now, args, nargs, kwnames);
    
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/chained.c: PyObject *temp = PyIU_PyObject_Vectorcall(PyTuple_GET_ITEM(self->funcs, 0), args, nargsf, kwnames);
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/chained.c: PyObject *temp = PyIU_PyObject_Vectorcall(func, args, nargsf, kwnames);
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/complement.c: temp = PyIU_PyObject_Vectorcall(((PyIUObject_Complement *)obj)->func, args, nargsf, kwnames);
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/flip.c: return PyIU_PyObject_Vectorcall(self->func, args, n_pos_args, kwnames);
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/flip.c: result = PyIU_PyObject_Vectorcall(self->func, stack, n_pos_args, kwnames);
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/helper.h: PyIU_PyObject_Vectorcall(PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwnames) {
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/helper.h: return _PyObject_Vectorcall(callable, args, nargsf, kwnames);
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/helper.h: return _PyObject_Vectorcall(callable, args, 1, NULL);
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/helper.h: return PyIU_PyObject_Vectorcall(callable, args, 2, NULL);
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/packed.c: result = PyIU_PyObject_Vectorcall(self->func, stack, num_packed_args, kwnames);
    PYPI-2023-04-13/iteration_utilities-0.11.0.tar.gz: iteration_utilities-0.11.0/src/iteration_utilities/_iteration_utilities/partial.c: result = PyIU_PyObject_Vectorcall(self->fn, stack, n_final_args, final_kwnames);
    

    Fixing these projects is easy: it's just about removing an underscore prefix.

  7. encukou commented on Jun 30, 2023

    @encukou
    encukou
    on Jun 30, 2023
    Member
    More actions

    Users have to decide which API is the "good one"

    in this case, it's obvious.

    Old APIs may have to be documented and tested (these aliases are in the docs)

    Oh, let's remove the docs!
    I don't think we need to test simple aliases.

    Other Python implementations have to implement it just because some C extensions use them: not all Python implementations can implement aliases with #define.

    That's OK, IMO.
    If the implementation is close to CPython, it needs to do much weirder things.
    If it's not that close, and users typically need some porting to use it, the users need to remove the underscore.

    Macros are not available in C extensions which don't use the header file but use directly symbols: macros are bad, see https://peps.python.org/pep-0670/

    Yes, you shouldn't use them and sometimes you can't. That doesn't apply to code that's already using them.

  8. vstinner commented on Jul 1, 2023

    @vstinner
    vstinner
    on Jul 1, 2023
    MemberAuthor
    More actions

    Just a reminder from the C API doc:

    Names prefixed by an underscore, such as _Py_InternalState, are private API that can change without notice even in patch releases. If you need to use this API, consider reaching out to CPython developers to discuss adding public API for your use case.

    I don't see why these aliases would be treated differently.

    By the way, in this case, there is already a public API for these private functions. So migrating code is trivial.

  9. encukou commented on Jul 3, 2023

    @encukou
    encukou
    on Jul 3, 2023
    Member
    More actions

    I don't see why these aliases would be treated differently.

    Because the API was added before that note was added to the docs. Those who used the API might not have seen the note, and it is unfair of us to change the rules later.
    If users read the docs now they should follow it, and it's not useful to add legacy considerations to user-facing docs. But core devs should follow the devguide and PEPs, and be conservative if there's any doubt.

  10. vstinner commented on Jul 22, 2023

    @vstinner
    vstinner
    on Jul 22, 2023
    MemberAuthor
    More actions

    I close this issue to continue the discussion in the more complete issue #106320.

  11. vstinner
    closed this as completedon Jul 22, 2023
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-API

    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.