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 takluyver
Recipients minrk, takluyver
Date 2015-02-04.23:50:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In tracking down an obscure error we were seeing, we boiled it down to this test case for thread.interrupt_main():

import signal, threading, _thread, time
signal.signal(signal.SIGINT, signal.SIG_DFL) # or SIG_IGN

def thread_run():

t = threading.Thread(target=thread_run)

This fails with an error message "TypeError: 'int' object is not callable", and a traceback completely disconnected from the cause of the error, presumably because it's not coming from the usual Python stack.

The problem appears to be that interrupt_main sets (in the C code) Handlers[SIGINT].tripped, which is only expected to occur when the handler is a Python function. When PyErr_CheckSignals() runs, it tries to call Handlers[SIGINT].func as a Python function, but it's a Python integer, causing the error.

I think the fix for this is to check what Handlers[sig_num].func is, either in trip_signal() before setting Handlers[sig_num].tripped, or in PyErr_CheckSignals before calling it. I can work on a patch if desired, but I'm not brilliant at C.
Date User Action Args
2015-02-04 23:50:50takluyversetrecipients: + takluyver, minrk
2015-02-04 23:50:50takluyversetmessageid: <>
2015-02-04 23:50:50takluyverlinkissue23395 messages
2015-02-04 23:50:49takluyvercreate