[issue2489] Patch for bugs in pty.py
New submission from Fergus Henderson <[EMAIL PROTECTED]>: The attached patch fixes some bugs in the pty.py module: - spawn() would not wait for the invoked process to finish. Also, it did not return a meaningful value, so there was no way to tell if the invoked process failed.After this patch, spawn() now waits for the invoked process, and returns the value returned from os.waitpid(). - There was a bug in the _copy() loop that caused it to spin using 100% CPU rather than blocking after EOF was reached on one of the two file descriptors that it was waiting for. -- components: Library (Lib) files: pty.py.patch keywords: patch messages: 64533 nosy: fergushenderson severity: normal status: open title: Patch for bugs in pty.py type: behavior versions: Python 2.4, Python 2.5, Python 2.6, Python 3.0 Added file: http://bugs.python.org/file9861/pty.py.patch __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2489> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2489] Patch for bugs in pty.py
Fergus Henderson <[EMAIL PROTECTED]> added the comment: On Tue, Mar 25, 2008 at 9:22 PM, Guilherme Polo <[EMAIL PROTECTED]> wrote: > > I would suggest using "if not data" to check for EOF Good idea. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2489> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue967161] pty.spawn() enhancements
Fergus Henderson added the comment: #1 is a duplicate of issue 2489 <http://bugs.python.org/issue2489>, which has a patch attached. According to the other discussion in this thread, #2 was a misunderstanding. So I think we could close this bug as a duplicate. -- nosy: +fergushenderson ___ Python tracker <http://bugs.python.org/issue967161> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2489] Patch for bugs in pty.py
Fergus Henderson added the comment: The spawn change (the last hunk of the original patch) is a bug fix, not an RFE. It has two parts that fix two bugs: (1) a coding bug: spawn() would not wait for the invoked process to finish. This is fixed by the line that adds the call to os.waitpid(). (2) a design bug: because previously spawn() didn't return a value, there is no way to tell if the invoked process failed. This is fixed by the "return status" line. Now I guess you can argue that (2) is an RFE. But (1) is just a bug fix, not an RFE, IMHO. Those are both separate from the other bug fixed in the patch: (3) Another coding bug: the bug in the _copy() loop that caused it to spin using 100% CPU rather than blocking It's a little tricky to write a test of the _copy() loop bug, for several reasons. (a) There currently isn't any test for pty.spawn, apparently since "Cannot do extensive 'do or fail' testing because pty code is not too portable." (b) Also, for this bug the symptom is just that the code spins (using 100% CPU, if available) rather than blocking. It's difficult to detect that situation using portable code. I can maybe figure out how deal with (a), but I'm not sure how to address (b), especially since I don't know the intended portability goals. I will split the patch up into two patches, one of which addresses (1)+(2), and the other of which addresses (3). I have addressed Guilherme Polo's suggestion about using "if not data". -- Added file: http://bugs.python.org/file14148/pty.py.patch3 ___ Python tracker <http://bugs.python.org/issue2489> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2489] Patch for bugs in pty.py
Changes by Fergus Henderson : Added file: http://bugs.python.org/file14149/pty.py.patch2 ___ Python tracker <http://bugs.python.org/issue2489> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com