Repository navigation
Trace the bodies of async functions and async generators - #2109
Conversation
|
The CI failure is probably unrelated: import sys
def f():
class Boom(Exception): pass
sys.settrace(lambda *a: None)
f()
sys.settrace(None)
f() # TypeError: Unable to cast ... Func`2[PythonFunction,Object] ... Func`2[CodeContext,CodeContext] |
|
I cannot reproduce any test failure (on Windows , using .NET 8). Also your sample code runs fine on my Windows system. In the log I also noticed something suspicious: I'll try to rerun the CI check. |
Interesting, for me this fails the majority of the time everywhere I tried (windows, mac, linux).
it's marked as ignore... |
I was finally able to reproduce it. It happens occasionally on my systems, which suggests a race condition of some sort. I was able to trigger it on both
That's wrong — it is supposed to be ignored only on .NET Framework/Mono. I will patch the .ini file here. |
slozier
left a comment
There was a problem hiding this comment.
Thanks, looks good to me!
This PR uses the DLR's async-body tracing (IronLanguages/dlr#369): the tracing variant of an async function hands its
Async/AsyncEnumerablenode the function's debug context, so the body is traced while the coroutine runs. Creating the coroutine is no longer traced, as in CPython.Also, some smaller fixes:
async defnow starts at its async keyword, so the 'call' location (and ast col_offset) match CPython.f_linenoon an async body frame raisesValueError(jumping is not supported there yet).GeneratorRewriter, like the DLR's in 369: an exception handler containing a yield that left its loop iteration early (continue/break) ran again after a later pass through the try that raised nothing. This affected sync generators, and async functions on .NET Framework as well.The DLR submodule is updated to the one with the async-body tracing implementation.
Fixes #2065, though for the full debugging support,
f_localsand jumps in an async body frame are still needed.