[issue45361] Provide a more convenient way to set an exception as "active", from Python code

2021-10-09 Thread Guido van Rossum
Guido van Rossum added the comment: In a brief off-line chat we concluded that the desired API would be closer to PyErr_Restore(). -- ___ Python tracker ___

[issue45361] Provide a more convenient way to set an exception as "active", from Python code

2021-10-05 Thread Guido van Rossum
Guido van Rossum added the comment: Do you think the API you're looking for is available at the C level? Like PyErr_SetExcInfo()? -- ___ Python tracker ___

[issue45361] Provide a more convenient way to set an exception as "active", from Python code

2021-10-04 Thread Nathaniel Smith
Nathaniel Smith added the comment: Ugh, the gnarly ExitStack bug is bpo-44594, not whatever I wrote above -- ___ Python tracker ___

[issue45361] Provide a more convenient way to set an exception as "active", from Python code

2021-10-04 Thread Nathaniel Smith
New submission from Nathaniel Smith : Inside 'except' and 'finally' blocks, the interpreter keeps track of the 'active exception in the thread-state. It can be introspected via `sys.exc_info()`, it enables bare `raise`, and it triggers implicit context propagation. In an odd bit of