Author ronaldoussoren
Recipients ned.deily, olivier-mattelaer, ronaldoussoren
Date 2012-10-22.10:46:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1350902792.31.0.631923151091.issue14892@psf.upfronthosting.co.za>
In-reply-to
Content
I've just tested this on OSX 10.8.2 and the problem is not present there (that is, 'python -c "import deadline" &' does not hang)

The problem is present on OSX 10.6.8, and when using ksh(1) you can see why the process is stopped:

[1] + Stopped(SIGTTOU)         python -c 'import readline' &

That signal is generated when the program generates output to a tty and the TOSTOP option of stty is active.  Whether or not that option is active is OS configuration (and can be changed using the stty command).

Reading the option:

import termios
lflags = termios.tcgetattr(0)[3]
print (lflags & termios.TOSTOP) != 0

Oddly enough the option off on both OSX 10.6 and 10.8, which point to a bug in OSX 10.6 (or to a misunderstanding of low-level tty programming details on my part which would not be unlikely)

Anyway, there is an easy workaround: before importing readline add:

import signal
signal.signal(signal.SIGTTOU, signal.SIG_IGN)

This ignores the SIGTTOU option and allows me to import readline on the background.

IMHO This issue can be closed because this behavior is not a Python bug but a platform feature.
History
Date User Action Args
2012-10-22 10:46:32ronaldoussorensetrecipients: + ronaldoussoren, ned.deily, olivier-mattelaer
2012-10-22 10:46:32ronaldoussorensetmessageid: <1350902792.31.0.631923151091.issue14892@psf.upfronthosting.co.za>
2012-10-22 10:46:32ronaldoussorenlinkissue14892 messages
2012-10-22 10:46:31ronaldoussorencreate