Closed
Description
Feature or enhancement
Currently, PyStackRef_FromPyObjectSteal
checks if the object is immortal in order to set the Py_TAG_DEFERRED
bit.
cpython/Include/internal/pycore_stackref.h
Lines 96 to 105 in 29cbcbd
This check isn't necessary and has a performance cost that's not made up for by the slightly faster PyStackRef_CLOSE()
calls or PyStackRef_Is()
checks.
We should simplify PyStackRef_FromPyObjectSteal
so that it creates _PyStackRef
directly from the PyObject *
without setting any tag bits.