[issue23395] _thread.interrupt_main() errors if SIGINT handler in SIG_DFL, SIG_IGN

Marcin Gozdalik report at bugs.python.org
Thu Sep 26 06:28:13 EDT 2019


Marcin Gozdalik <gozdal at gmail.com> added the comment:

A program which failed under Python 3.6 with

TypeError: 'int' object is not callable

still fails under Python 3.7.4 with same exception:

import signal
import os
import sys
import time

import multiprocessing

def fail():
    def handler(*args):
        pass

    while True:
        signal.signal(signal.SIGUSR1, signal.SIG_IGN)
        signal.signal(signal.SIGUSR1, handler)

proc = multiprocessing.Process(target=fail)
proc.start()
time.sleep(1)
pid = proc.pid

i = 0
try:
    while proc.is_alive():
        print("\r", end='')
        print(i, end='')
        i += 1
        os.kill(pid, signal.SIGUSR1)
        time.sleep(0.001)
finally:
    proc.join()

----------
nosy: +gozdal

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


More information about the Python-bugs-list mailing list