Charles-François Natali <neolo...@free.fr> added the comment:

It's a little bit more complicated than that:
- signals and threads don't mix well together
- this will make syscalls fail with EINTR
- the old SIGALRM handler is lost
- etc

In short, don't use signals.
I'm not sure there's a reliable way to write such a general-purpose wrapper 
(usually one can use select() with a timeout or spawn a subprocess and use 
communicate's timeout to achieve this kind of things).
In your use case (issue #12157), I think that letting the test block is fine, 
since:
- there's no easy way to add a timeout (but you could spawn a new interpreter 
and use communicate with a timeout if you really wanted to)
- it will be caught by the faulthandler module
- a test killed by faulthandler's timeout is more interesting to fix that a 
"common" failed test ;-)

----------
nosy: +neologix

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to