If that’s the only issue we could add a PyFrame_GetVarByIndex (after PyFrame_GetVar.)
Sounds good.
Nah, that can go in a different PR.
Guess this is related to your post from an unrelated thread: “The unavoidable premise is that the docs are the definitive source of truth on what’s “public” (aka. intended to be used), because that’s how it’s always been done.”
Except… that’s not unavoidable, and I think that in the C API, we can get to a state where the leading underscore means “don’t touch”. Adding PyUnstable versions for documented-but-underscored API has been argued, and even approved in PEP 689. Also, PEP 387 very explicitly excludes underscored names from public API.
For the sake of not breaking existing code, we can soft-deprecate the old name instead of using Py_DEPRECATED.