New submission from Zdenek Pavlas:

Quoting from "signal" module docs:

# Although Python signal handlers are called asynchronously as far as the 
Python user is concerned, they can only occur between the “atomic” instructions 
of the Python interpreter.

Yes, that's reasonable.

# This means that signals arriving during long calculations implemented purely 
in C (such as regular expression matches on large bodies of text) may be 
delayed for an arbitrary amount of time.

IMO, A does not imply B.  Long computation in C with GIL released does not need 
to be atomic, as it happens "between" Python instructions.  

The thunk that's called asynchronously should preempt the C computation and 
issue a Python callback when possible.  Otherwise, Python handlers are useless 
when interfacing C code.

components: Interpreter Core
files: trip-signal.patch
keywords: patch
messages: 176428
nosy: zdenek.pavlas
priority: normal
severity: normal
status: open
title: Python sighandlers delayed for no reason
type: behavior
versions: Python 2.7
Added file:

Python tracker <>
Python-bugs-list mailing list

Reply via email to