* _PyTuple_ITEMS() gives access to the tuple->ob_item field; cast the first argument to PyTupleObject*. The macro is only usable if Py_BUILD_CORE is defined. * Replace &PyTuple_GET_ITEM(ob, 0) with _PyTuple_ITEMS(ob) * Replace PyTuple_GET_ITEM(op, 1) with &_PyTuple_ITEMS(ob)[1]
|
@rhettinger I am confused here... the bpo issue was closed saying that it wouldn't be merged but the PR was merged anyway. |
I rejected my experimental PR #10435. See https://bugs.python.org/issue35199#msg329577 |
So then what is the purpose of this PR? Apart from just adding a new way to do something which can already be done using Asking from the point of view of a CPython developer: when should I use |
This change allows me to experiment changes on PyTuple_GET_ITEM() like https://bugs.python.org/issue35337 It's also related to my more long-term plan to making type structures like PyTupleObject opaque: https://pythoncapi.readthedocs.io/bad_api.html#c-structures |
_PyTuple_ITEMS is used for direct access to the internal PyObject** array, whereas PyTuple_GET_ITEM() is used to get a single item. |
first argument to PyTupleObject*. The macro is only usable if
Py_BUILD_CORE is defined.
https://bugs.python.org/issue35199