Nick Coghlan added the comment:

The updated PR fully resolves the synchronous CM case by switching to using 
threading.Lock as the test CM (as per Nathaniel's original suggestion). Without 
that, the pending exception was being processed as soon as __exit__() started 
running, so the test failed due to the lack of signal safety in the test CM 
itself.

For the asynchronous case, Greg and I aren't seeing any way to resolve the 
situation without somehow making the pending call processing event loop aware - 
otherwise even if the current frame postpones dealing with the pending call, it 
will still get processed as soon as YIELD_FROM returns control to the asyncio 
event loop. The one thing we think may work is to provide a way for asyncio (et 
al) to configure a thread such that all pending calls are routed to the 
thread's event loop for handling, rather than being processed directly by the 
eval loop.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29988>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to