[issue27889] ctypes interfers with signal handling

Andre Merzky report at bugs.python.org
Tue Sep 13 03:44:48 EDT 2016


Andre Merzky added the comment:

FWIW, a workaround seems to be a nested try/except clause:

try:
  try:
    do_lots_of_work()
  except RuntimeError as e:
    print 'signal handling worked'
except RuntimeError:
  print 'signal handling delayed'

I did a stress test over 100k runs, and got no unexpected behavior that way.  I am not sure if the underlying race condition is just hidden, or if the inner except clause triggers the signal handling code internally -- either way, while cumbersome to use, it seems to work.

I'd still appreciate feedback on a cleaner solution.

Thanks, Andre.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27889>
_______________________________________


More information about the Python-bugs-list mailing list