[issue21822] KeyboardInterrupt during Thread.join hangs that Thread

Géry report at bugs.python.org
Fri Jun 21 04:17:47 EDT 2019


Géry <gery.ogam at gmail.com> added the comment:

I am having the same blocked signal issue on Windows when using Thread.join. This program does not print "interrupted" after pressing Ctrl+C:


import threading
import time


def f():
    while True:
        print("processing")
        time.sleep(1)


if __name__ == "__main__":
    try:
        thread = threading.Thread(target=f)
        thread.start()
        thread.join()
    except KeyboardInterrupt:
        print("interrupted")


For reference, 2 years ago Nathaniel Smith gave an interesting explanation here:
https://mail.python.org/pipermail/python-dev/2017-August/148800.html.

----------
nosy: +maggyero

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue21822>
_______________________________________


More information about the Python-bugs-list mailing list