Add eval frame FFI bindings#6195
Conversation
|
These were removed in #5711 |
|
I am using these functions for a custom Python interpreter function hook. This is a useful API to expose to inject code in older versions which do not have sys.monitoring. A simple search on Github of " = _PyInterpreterState_GetEvalFrameFunc" shows hundreds of usages, so I think it is reasonable for PyO3 to expose this. |
7eedeb0 to
4034e43
Compare
Merging this PR will degrade performance by 25.79%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | into_u128_max |
1.5 µs | 2 µs | -25.79% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing adamgerhant-ai:eval-frame-ffi (4b14495) with main (8fcf8fc)
4741429 to
4b14495
Compare
Adds FFI bindings for
_PyInterpreterState_GetEvalFrameFunc,_PyInterpreterState_SetEvalFrameFunc, and_PyFrameEvalFunction.In 3.11
_PyInterpreterState_GetEvalFrameFuncreturns_PyEval_EvalFrameDefaultif it is NULL, so the Option is removed from the return type.Would it be acceptable to expose
_PyEval_EvalFrameDefaultin this PR since it may be required by older versions?