Xavier de Gaye added the comment: The following code shows that the trace function is removed when an alarm raises an exception and prints: 'trace function: None'
import sys, signal, time def trace(frame, event, arg): if frame.f_code.co_name == 'foo': while 1: time.sleep(.02) return trace def foo(): pass def handler(*args): 1/0 sys.settrace(trace) signal.signal(signal.SIGALRM, handler) signal.alarm(1) try: foo() except ZeroDivisionError: pass print('trace function:', sys.gettrace()) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20601> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com