This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kmaork
Recipients Zhibin Dong, asvetlov, kmaork, yselivanov
Date 2020-02-25.22:35:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Damn, good catch. How about the following idea - register a normal signal handler (using signal.signal) that does something like:

def sigint_handler():

# in class BaseEventLoop
def interrupt(self):
    # Might be a generally useful thread-safe way to interrupt a loop
    if self._is_inside_callback():
        _thread.interrupt_main() # All this behavior is only relevant to the main thread anyway
        self._interrupted = True

And inside BaseEventLoop._run_once() add the following check:

# in class BaseEventLoop
def _check_interrupted(self):
    # This will be called by BaseEventLoop._run_once() before calling select,
    # and before popping any handle from the ready queue
    if self._interrupted:
        raise KeyboardInterrupt
Date User Action Args
2020-02-25 22:35:29kmaorksetrecipients: + kmaork, asvetlov, yselivanov, Zhibin Dong
2020-02-25 22:35:29kmaorksetmessageid: <>
2020-02-25 22:35:29kmaorklinkissue39622 messages
2020-02-25 22:35:29kmaorkcreate