You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've hit this trying to pass the fake traceback object to pdb.post_mortem().
I can see which attributes it's after, and it works if I set them to the correct empty values.
Should I just set them to these empty values (fairly easy to do) or should I try to get the correct values from the original stack frames? The latter is more difficult as the stack frames are passed around as 5-tuples at some points and that tuple would need extending (I'd probably make it a named tuple and add attributes).
On a related note, I've discovered that the f_locals and f_globals on the fake stack frames are set to empty even if captureVars is set. It's relatively simple to correct. Does that need another ticket?
Also, should the fake traceback have all the attributes that a real one would or should it only have the ones we know it needs? If it needs all of them, do any of them need sanitising the way we do for the locals and globals?
Hi.
Built-in "traceback" objects are expected to have a "tb_lasti" attribute: https://docs.python.org/3/library/inspect.html#types-and-members
However, "_TracebackFrame" objects in Twister "failure.py" are missing this attribute:
twisted/src/twisted/python/failure.py
Lines 133 to 145 in 29cbea3
Hence, the assertion "Fake traceback object which can be passed to functions in the standard library" is erroneous, it may raises an exception with dis.distb for example: https://github.com/python/cpython/blob/master/Lib/dis.py#L96
Would this be possible for the _TracebackFrame objects to better match the expected standard API and don't raise AttributeError?
Searchable metadata
The text was updated successfully, but these errors were encountered: