Selim Belhaouane <selim.belhaou...@gmail.com> added the comment:

Playing with this a bit more, I found a weird workaround. By adding the 
following to the top of worker_sync(), Experiment 1 produces the expected 
result.

def worker_sync():
    async def clear_asyncio_signal_handlers():
        loop = asyncio.get_event_loop()
        loop.add_signal_handler(signal.SIGINT, signal.SIG_IGN)
    asyncio.run(clear_asyncio_signal_handlers())

    if WORKER_SIGNAL_HANDLER is WorkerSignalHandler.NONE:
    [...]

FYI, this did *not* work (the outcome is still the same for Experiment 1):

def worker_sync():
    loop = asyncio.get_event_loop()
    loop.add_signal_handler(signal.SIGINT, signal.SIG_IGN)

    if WORKER_SIGNAL_HANDLER is WorkerSignalHandler.NONE:
    [...]


Maybe this all can be flagged as "as designed". However, perhaps it could be 
documented?

----------

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

Reply via email to