[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2021-09-21 Thread STINNER Victor
STINNER Victor added the comment: The PEP 620 is still a draft. I prefer to work on other C API changes before coming back to this change which may break many C extensions. I failed finding time to design an API to expose a PyObject** array "view" with a function to release/destroy the view.

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-23 Thread STINNER Victor
STINNER Victor added the comment: See "(PEP 620) C API for efficient loop iterating on a sequence of PyObject** or other C types" thread on python-dev: https://mail.python.org/archives/list/python-...@python.org/thread/632CV42376SWVYAZTHG4ROOV2HRHOVZ7/ --

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
STINNER Victor added the comment: I suggest you to discuss the PEP 620 on python-dev, rather than on the bug tracker. I just posted it there today. This issue tracks the implemetation of one part of the PEP 620. -- ___ Python tracker

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread Stefan Behnel
Stefan Behnel added the comment: > Also, later, these structures may change to be more efficient. Tuples? Really? Ok, quoting PEP-620: > Members of … PyTupleObject structures have not changed since the "Initial > revision" commit (1990) I honestly think the reason for that might simply be th

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
STINNER Victor added the comment: The long rationale is explained in PEP 620: https://www.python.org/dev/peps/pep-0620/ PyTupleObject and PyListObject structures must become opaque. Also, later, these structures may change to be more efficient. -- ___

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread Stefan Behnel
Stefan Behnel added the comment: > Giving a direct access to an array or PyObject* (PyObject**) is causing > issues with other Python implementations, like PyPy, which don't use PyObject > internally. I'm wondering – if the intention is to help other implementations, then why do we need to b

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
STINNER Victor added the comment: PySequence_Fast_ITEMS() is used in numpy at 7 lines: numpy/core/src/common/ufunc_override.c:118:*out_objs = PySequence_Fast_ITEMS(seq); --- PyUFuncOverride_GetOutObjects(PyObject *kwds, PyObject **out_kwd_obj, PyObject ***out_objs) --- => PyObject**

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
STINNER Victor added the comment: PySequence_Fast_ITEMS() must also be deprecated since it also gives a direct access to PyTupleObject.ob_item and PyListObject.ob_item members (PyObject**). PySequence_Fast_GET_ITEM() should be used instead. -- ___

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
STINNER Victor added the comment: The PR 21059 breaks Cython. I reported the issue to Cython upstream: https://github.com/cython/cython/issues/3701 numpy is also affected: code generated by Cython (numpy/random/_mt19937.c) contains the issue. -- _

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +20230 pull_request: https://github.com/python/cpython/pull/21059 ___ Python tracker ___ __

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
STINNER Victor added the comment: New changeset c96d00e88ead8f99bb6aa1357928ac4545d9287c by Victor Stinner in branch 'master': bpo-41078: Fix bltinmodule.c with Py_TRACE_REFS (GH-21058) https://github.com/python/cpython/commit/c96d00e88ead8f99bb6aa1357928ac4545d9287c -- ___

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +20229 pull_request: https://github.com/python/cpython/pull/21058 ___ Python tracker ___ __

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
STINNER Victor added the comment: New changeset c45dbe93b7094fe014442c198727ee38b25541c4 by Victor Stinner in branch 'master': bpo-41078: Add pycore_list.h internal header file (GH-21057) https://github.com/python/cpython/commit/c45dbe93b7094fe014442c198727ee38b25541c4 -- _

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
STINNER Victor added the comment: New changeset 384621c42f9102e31ba2c47feba144af09c989e5 by Victor Stinner in branch 'master': bpo-41078: Rename pycore_tupleobject.h to pycore_tuple.h (GH-21056) https://github.com/python/cpython/commit/384621c42f9102e31ba2c47feba144af09c989e5 -- __

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +20228 pull_request: https://github.com/python/cpython/pull/21057 ___ Python tracker ___ __

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +20227 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21056 ___ Python tracker ___ _

[issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

2020-06-22 Thread STINNER Victor
New submission from STINNER Victor : PyTuple_GET_ITEM() can be abused to access directly the PyTupleObject.ob_item member: PyObject **items = &PyTuple_GET_ITEM(0); Giving a direct access to an array or PyObject* (PyObject**) is causing issues with other Python implementations, like PyPy,