Advice upgrading PEP 523 hobby project to 3.11

skean is a project hack which (ab)uses PEP 523 to make certain python function calls reactive (see README for an example). I am struggling to upgrade to 3.11 because of “[C API] Move PyFrameObject to the internal C API” (gh-90992). I agree with Mark Shannon’s advice that I “probably want to operate on the _PyInterpreterFrame struct, rather than the PyFrameObject.” Unfortunately, skean.pyx squirrels precious info in the .f_trace member of PyFrameObject to track callers.

What is this group’s advice to migrate these intrusive mutations given _PyInterpreterFrame is opaque?

Genuine question: Why do you need any C API to implement something like this? Do you have a more complex example somewhere?

Or do you just want to do it with PEP 523 because you can?

I don’t absolutely need PEP 523 to do this. Case in point, dag.py shows pure python approaches to achieve similar things.

The PEP 523/Cython version is faster and uses less memory.

I have revisited this issue today, see my progress in jburgy/skean#2. As the PR explains, I am not at an impasse and looking for a way to access current locals. Suggestions?

Ok, I broke some (all?) rules and found that (<PyObject **>_frame) + 9 lets me access the current _PyInterpreterFrame’s localplus. No such thing as opacity in C!