
On Thu, 2 Sep 2021 13:31:32 +1200 Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
On 2/09/21 4:46 am, Victor Stinner wrote:
If creating a fake frame is a common use case, we can maybe write a public C API for that. For example, I saw parser injecting frames to show the file name and line number of the parsed file in the traceback.
The way I would like to see this addressed is to make it possible to attach a filename and line number directly to a traceback object, without needing a frame or code object at all.
Tracebacks are linked in a single direction, to go the other direction you need to walk the frames attached to the traceback. If there is no frame on the traceback, you cannot go the other direction. So a (fake or not) frame object is still desirable, IMHO. Regards Antoine.