That code won't work in the current version of python. There are many variables starting with SIG with the same value. For instance, SIGHUP and SIG_UNBLOCK are both 1. The only way I could think of to get a list of actual signals was to just make it myself.
from signal import *
signals = {
SIGABRT: 'SIGABRT',
SIGALRM: 'SIGALRM',
SIGBUS: 'SIGBUS',
SIGCHLD: 'SIGCHLD',
SIGCONT: 'SIGCONT',
SIGFPE: 'SIGFPE',
SIGHUP: 'SIGHUP',
SIGILL: 'SIGILL',
SIGINT: 'SIGINT',
SIGPIPE: 'SIGPIPE',
SIGPOLL: 'SIGPOLL',
SIGPROF: 'SIGPROF',
SIGQUIT: 'SIGQUIT',
SIGSEGV: 'SIGSEGV',
SIGSYS: 'SIGSYS',
SIGTERM: 'SIGTERM',
SIGTRAP: 'SIGTRAP',
SIGTSTP: 'SIGTSTP',
SIGTTIN: 'SIGTTIN',
SIGTTOU: 'SIGTTOU',
SIGURG: 'SIGURG',
SIGUSR1: 'SIGUSR1',
SIGUSR2: 'SIGUSR2',
SIGVTALRM: 'SIGVTALRM',
SIGXCPU: 'SIGXCPU',
SIGXFSZ: 'SIGXFSZ',
}
for num in signals:
signal(num, h)