the.bay.news

Add `PyUnstable_InterpreterFrame_GetLocals()`: read a frame’s locals from the interpreter-frame C API

Discussions on Python.org
Add `PyUnstable_InterpreterFrame_GetLocals()`: read a frame’s locals from the interpreter-frame C API
I work on TorchDynamo, PyTorch’s JIT compiler. Dynamo relies on the eval frame API (PEP 523), and one of the things it needs to do when a frame is traced is to read the frame’s local variables. CPython has 3 public APIs for reading frame locals, but none of them are suitable to be used in Dynamo: PyFrame_GetLocals(PyFrameObject*) PyFrame_GetVar(PyFrameObject*, PyObject*) PyEval_GetFrameLocals(void) The first two take a PyFrameObject* as first argument and there’s no public way to get one fro...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.