[Python-Dev] test_pty.py hangs in verbose mode on Mac OS X? (original) (raw)
Barry Warsaw barry at python.org
Fri Apr 13 17:22:34 CEST 2007
- Previous message: [Python-Dev] test_pty.py hangs in verbose mode on Mac OS X?
- Next message: [Python-Dev] Pydoc Rewrite Discussion at doc-sig list.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Apr 13, 2007, at 11:07 AM, Jean-Paul Calderone wrote:
Likely differing buffering behavior. Prior to Linux 2.6, the pipe implementation allowed only a single buffer (that is, the bytes from a single write call) in a pipe at a time, and blocked subsequent writes until that buffer was read. Recently this has changed to allow multiple buffers up to 4k total length, so multiple short writes won't block anymore. OS X may have some other buffering behavior which is causing writes to block where they don't on Linux. All these details are left to the platform, and there are a variety of behaviors which can be considered valid.
Of course, I don't actually /know/ the cause of the problem here, but this explanation seems plausible to me, and I'd investigate it before looking for platform-specific pty bugs (although OS X is a good platform on which to go looking for those ;).
Seems plausible to me too. If I change the child writes to > 4000
bytes, Linux w/2.6 kernel will block too.
I'm going to change the test_pty.py code to read from the master_fd.
You have to wrap the read in a try/except to catch the OSError input/
output error you'll get on Linux when you read past the end of the
buffer and the child process has already exited.
Thanks,
- -Barry
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin)
iQCVAwUBRh+gO3EjvBPtnXfVAQJkQAP9E2Jp/EeF3ChIeNZEPVMDeG4Kd+PVslSs blNFO2oO6eO8Yn9X3hlnLwCe3W6+89bS9u7MyN1C2CCZTBz6N1QAkfDaAnxuhbNC 3hfvytMguTY0v3RiZhEVY+y/h2PfbWe6fJGXeBIfcth1HWhP0KWIgAoDA+odDm1B vZSvcxBRN1Y= =fDrh -----END PGP SIGNATURE-----
- Previous message: [Python-Dev] test_pty.py hangs in verbose mode on Mac OS X?
- Next message: [Python-Dev] Pydoc Rewrite Discussion at doc-sig list.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]