[issue35751] traceback.clear_frames manages to deadlock a background task

2019-01-16 Thread Taras Voinarovskyi
Taras Voinarovskyi added the comment: For now, it seems like ``copy.copy(exception)`` before raising seems to prevent this behaviour. So for all exceptions originating from background tasks I raise a copy to the user, rather than the original exception. It prints correct stack, so no real im

[issue35751] traceback.clear_frames manages to deadlock a background task

2019-01-16 Thread Yury Selivanov
Yury Selivanov added the comment: Very interesting. Thanks for reporting this issue. I'll definitely take a look at this before 3.8 is released. For 3.7 you'll likely have to find a workaround. -- ___ Python tracker

[issue35751] traceback.clear_frames manages to deadlock a background task

2019-01-16 Thread Taras Voinarovskyi
Taras Voinarovskyi added the comment: So yes, the `clear_frames` function will force a running generator to close. See https://github.com/python/cpython/blob/3.7/Objects/frameobject.c#L566, it explicitly does a Finalize. Would that be the desired behaviour for assertRaises is not clear. I fi

[issue35751] traceback.clear_frames manages to deadlock a background task

2019-01-16 Thread Тарас Войнаровський
New submission from Тарас Войнаровський : My use case: I have a background task, say called "coordination". In that task, I want to catch any errors and push those to the user waiting in the main task and only continue running the background coroutine after the user manually resolves the excep