[issue36031] add internal API function to effectively convert just created list to tuple

STINNER Victor report at bugs.python.org
Wed Feb 20 05:48:09 EST 2019


STINNER Victor <vstinner at redhat.com> added the comment:

_PyList_ConvertToTuple(PyObject *v):
    assert(Py_REFCNT(v) == 1);

I don't think that _PyList_ConvertToTuple() usage is common enough to justify this micro-optimization.

IMHO "Py_REFCNT(v) == 1" assumption is too strong. Python internals can be very surprising, especially when borrowered references and the garbage collector comes into the game.

I concur with Serhiy and Raymond: it's too risky with very low benefit. It is likely to have no significant impact on macro benchmarks like https://pyperformance.readthedocs.io/ ( https://speed.python.org/ ).

----------
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36031>
_______________________________________


More information about the Python-bugs-list mailing list