[issue22865] Document how to make pty.spawn not copy data
Geoff Shannon added the comment: @martin.panter I removed the mention of inserting null bytes and restricted the documentation updates to more fully documenting the current behaviour. -- ___ Python tracker <https://bugs.python.org/issue22865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22865] Document how to make pty.spawn not copy data
Change by Geoff Shannon : -- pull_requests: +13364 ___ Python tracker <https://bugs.python.org/issue22865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22865] Document how to make pty.spawn not copy data
Geoff Shannon added the comment: It is submitted @cheryl.sabella. Thanks for reviving this, I had totally lost track of it. -- ___ Python tracker <https://bugs.python.org/issue22865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x
Change by Geoff Shannon : -- pull_requests: +12074 ___ Python tracker <https://bugs.python.org/issue26228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x
Geoff Shannon added the comment: I took a shot at fixing this in a smaller more targeted patch. I think this should still solve the major issue of pty.spawn hanging on platforms that don't raise an error. In addition, pty.spawn should now _ALWAYS_ return the terminal to the previous settings. -- nosy: +RadicalZephyr ___ Python tracker <https://bugs.python.org/issue26228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x
Geoff Shannon added the comment: I'm aware of it. I actually wrote that patch as well. :D -- ___ Python tracker <https://bugs.python.org/issue26228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22865] Allow pty.spawn to ignore data to copy
New submission from Geoff Shannon: While using the pty.py module I had cause to want to be able to silently eat characters from the input stream. I discovered that because of the check for end of file being "if not data" that there was no way to do this. Since the default function used by spawn and _copy is a thin wrapper on os.read, I figured that it would be useful to interpret None as a sentinel value meaning "this is not EOF, but there's nothing I actually want to copy over." -- assignee: docs@python components: Documentation, Library (Lib) files: pty.patch keywords: patch messages: 231126 nosy: RadicalZephyr, docs@python priority: normal severity: normal status: open title: Allow pty.spawn to ignore data to copy type: enhancement versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file37189/pty.patch ___ Python tracker <http://bugs.python.org/issue22865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22865] Allow pty.spawn to ignore data to copy
Geoff Shannon added the comment: I tweaked the patch a bit to not include the parentheses since that seems to be the style here. -- Added file: http://bugs.python.org/file37620/pty.patch ___ Python tracker <http://bugs.python.org/issue22865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22865] Document how to make pty.spawn not copy data
Geoff Shannon added the comment: Hey, pinging this issue. Hoping someone has time to take a look at it. -- ___ Python tracker <http://bugs.python.org/issue22865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22865] Document how to make pty.spawn not copy data
Geoff Shannon added the comment: Hmm, I spoke improperly. I think you are entirely correct in your statements. What I meant by "terminals ignore null bytes" is that returning a string consisting of only a null byte doesn't cause anything observable to happen, including anything to be written to the screen. But I have no idea why this is. My basis for this is limited to empirical observation of how my terminal behaves (I use the iTerm2 terminal emulator on Mac OS X), and I don't recall whether I checked it with other terminals like the regular terminal on Mac and terminal emulators on Linux. Re: "or any falsey value". In general, the _read_ functions should return byte strings yes, but since the check for EOF in python is whether a stream returned an empty string, and the way that pty.spawn() currently checks for that is `if not data` then any falsey value will cause pty.spawn to think that the underlying fd was closed. I agree that the documentation on this could use more fleshing out in general, especially regarding what happens when certain values are returned. I'm not very familiar with this code any more, but I might have time to play with it and try to add some more information in the coming weeks. -- ___ Python tracker <http://bugs.python.org/issue22865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22865] Document how to make pty.spawn not copy data
Geoff Shannon added the comment: Okay, I just found another way to achieve the same effect of letting the _read function ignore data but not inadvertantly close the stream. It relies on the fact that terminals will ignore null bytes fed to them. Now there are no code changes required, just an addition to the documentation. -- components: -Library (Lib) title: Allow pty.spawn to ignore data to copy -> Document how to make pty.spawn not copy data Added file: http://bugs.python.org/file39313/pty.patch ___ Python tracker <http://bugs.python.org/issue22865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com