[issue16560] Python sighandlers delayed for no reason

2012-11-27 Thread Zdenek Pavlas
Zdenek Pavlas added the comment: > for example, if you call malloc() from within a signal handler, you can get a > deadlock or a crash if the signal was received while the process was in the > middle of an malloc() call. Thanks, I see the problem. malloc() implements locking (when threads are

[issue16560] Python sighandlers delayed for no reason

2012-11-27 Thread Charles-François Natali
Charles-François Natali added the comment: > the reason why signal handlers are called synchronously from the main loop is because you can't call arbitrary called on behalf of a signal handler: the must be async safe. > > > Could you elaborate, please? Suppose Python has called a C module. From

[issue16560] Python sighandlers delayed for no reason

2012-11-27 Thread Zdenek Pavlas
Zdenek Pavlas added the comment: > This patch isn't safe Yes, it's broken. Does not work unless thread support was enabled, and locking initialized. There are probably other bugs, too. Not meant to be included, really. But IMO the correct implementation should work along these lines. > th

[issue16560] Python sighandlers delayed for no reason

2012-11-26 Thread Charles-François Natali
Charles-François Natali added the comment: > Not sure if this would be a feature request or a bugfix That would rather be a bug injection. This patch isn't safe: the reason why signal handlers are called synchronously from the main loop is because you can't call arbitrary called on behalf of a

[issue16560] Python sighandlers delayed for no reason

2012-11-26 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: Not sure if this would be a feature request or a bugfix, specially in the python 2.7 case :). -- nosy: +jcea versions: +Python 3.2, Python 3.3, Python 3.4 ___ Python tracker

[issue16560] Python sighandlers delayed for no reason

2012-11-26 Thread Zdenek Pavlas
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