Unsafe DECREFs of borrowed references in the interpreter. #125323
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
It is unsafe to borrow a
PyObject *
reference from a_PyStackRef
andPy_DECREF
thePyObject *
reference and not close the_PyStackRef
. This is quite a common pattern in bytecodes.c, and prevents any optimizations based on reference lifetimes as the inferred lifetime is incorrect.The fix for this is to change the incorrect pattern:
to the correct pattern:
This is causing problems, as optimizations to exploit stack refs don't work: https://github.com/python/cpython/compare/main...faster-cpython:cpython:use-stackrefs-opt-experiment?expand=1
CPython versions tested on:
CPython main branch
Operating systems tested on:
Other
Linked PRs
The text was updated successfully, but these errors were encountered: