[issue1975] signals not always delivered to main thread, since other threads have the signal unmasked
nh2 added the comment: I think this is still an issue. If I register signal.signal(signal.SIGINT, handler) in the main thread, I get a race between - only the main thread receives the signal (everything is fine) - both the main thread and currently running threads receive the signal => the handler is called multiple times => all kinds of resource-problems like "close failed in file object destructor: IOError: [Errno 9] Bad file descriptor" in thread cleanup functions Note that I cannot even declare a sigintlock = threading.Lock() and use with sigintlock in the handler - if I print threading.current_thread() and sys.exit() directly afterwards in the locked area, I sometimes get two print outputs which show MainThread and Thread-1 being inside the locked area at the same time! Is the synchronization broken or am I doing something wrong? Is synchronization over handlers really the way to cope with this? Disabling signals for non-main threads currently seems more sensible to me. Can someone please verify the race I get? ------ nosy: +nh2 ___ Python tracker <http://bugs.python.org/issue1975> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1975] signals not always delivered to main thread, since other threads have the signal unmasked
nh2 added the comment: My problem was actually related to the subprocess.Popen I use inside my threads in combination with signals. As Popen does not spawn a new thread, but a new process, it completely ignores my locks. However, it seems impossible to safely unregister signals for subprocesses. I tried using SIG_IGN in preexec_fn for Popen as well as a ignore/Popen/unignore wrapper, but both result in race conditions (for the first: if the signal arrives between fork and exec and for the second if it arrives within the wrapper). I think ignoring signals by default for everything but the main thread or process would solve this problem and make parallel programming with events in Python a lot easier. Explicit is better than implicit. -- ___ Python tracker <http://bugs.python.org/issue1975> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2504] Add gettext.pgettext() and variants support
nh2 added the comment: Me too. This makes developing applications with good localizations in Python really difficult. -- nosy: +nh2 ___ Python tracker <http://bugs.python.org/issue2504> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com