[issue22865] Document how to make pty.spawn not copy data

2019-05-21 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Geoff Shannon for the doc enhancement!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
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

2019-05-21 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset cdb2dbfe92b95dcd19ccab1a1e9b8c39263c54b0 by Victor Stinner (Geoff 
Shannon) in branch '3.7':
[3.7] bpo-22865: Expand on documentation for the pty.spawn function (GH-11980) 
(GH-13455)
https://github.com/python/cpython/commit/cdb2dbfe92b95dcd19ccab1a1e9b8c39263c54b0


--

___
Python tracker 

___
___
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

2019-05-20 Thread Geoff Shannon


Change by Geoff Shannon :


--
pull_requests: +13364

___
Python tracker 

___
___
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

2019-05-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 522ccef8690970fc4f78f51a3adb995f2547871a by Victor Stinner (Geoff 
Shannon) in branch 'master':
bpo-22865: Expand on documentation for the pty.spawn function (GH-11980)
https://github.com/python/cpython/commit/522ccef8690970fc4f78f51a3adb995f2547871a


--
nosy: +vstinner

___
Python tracker 

___
___
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

2019-05-19 Thread Geoff Shannon


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 

___
___
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

2019-02-21 Thread Martin Panter


Martin Panter  added the comment:

I'm not sure it is wise for the Python documentation to suggest inserting null 
bytes in general. This seems more like an application-specific hack. There is 
nothing in Python that handles these null bytes specially, and I expect they 
will be seen if the child reads the terminal in raw mode, or if the parent's 
output is redirected to a file, sent over the network or a real serial link.

--

___
Python tracker 

___
___
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

2019-02-21 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Thanks @RadicalZephyr!  

@martin.panter, please review the PR when you get a chance.  Thank you!

--

___
Python tracker 

___
___
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

2019-02-21 Thread Geoff Shannon


Geoff Shannon  added the comment:

It is submitted @cheryl.sabella. Thanks for reviving this, I had totally lost 
track of it.

--

___
Python tracker 

___
___
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

2019-02-21 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +12004

___
Python tracker 

___
___
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

2019-02-20 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@RadicalZephyr, are you interested in making a GitHub pull request with the 
recommended the documentation change?

--
nosy: +cheryl.sabella
versions: +Python 3.7, Python 3.8 -Python 2.7, Python 3.4, Python 3.5, Python 
3.6

___
Python tracker 

___
___
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

2015-10-07 Thread Martin Panter

Martin Panter added the comment:

I would avoid suggesting one can return non-byte-strings; treat that as an 
implementation detail. Maybe something like:

The functions *master_read* and *stdin_read* are passed a file descriptor which 
they should read from, and should return a byte string. The defaults try to 
read 1024 bytes each time they are called. Returning an empty string is be 
interpreted as an EOF condition, and the *_read* function will no longer be 
called.

--

___
Python tracker 

___
___
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

2015-10-06 Thread Martin Panter

Martin Panter added the comment:

If you return null bytes, they will be written to the parent process’s stdout 
file descriptor, rather than being ignored. I do not think it is possible to 
ignore output with the spawn() API, unless perhaps you previously set up stdout 
write to /dev/null or similar.

Do you have a reference for your fact about terminals ignoring null input 
bytes? I’m skeptical because a basic serial terminal can send arbitrary data 
including nulls, but I am not so familiar with pseudo-terminals.

However the bit about interpreting an empty string could be useful. I would 
drop the “or any falsey value”; is that a typo? I suspect that the functions 
have to return byte strings (not text). It would be nice to say what the 
consequences of the EOF condition is, e.g. I can see for the child’s output it 
would stop copying, but not actually close the parent’s stdout to signal EOF. 
What about in the other direction? Can you signal multiple EOFs with data in 
between?

--
nosy: +martin.panter
stage:  -> patch review
versions:  -Python 3.2, Python 3.3

___
Python tracker 

___
___
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

2015-10-06 Thread Geoff Shannon

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 

___
___
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

2015-06-07 Thread Geoff Shannon

Geoff Shannon added the comment:

Hey, pinging this issue.  Hoping someone has time to take a look at it.

--

___
Python tracker rep...@bugs.python.org
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

2015-06-07 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +twouters

___
Python tracker rep...@bugs.python.org
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

2015-05-07 Thread Geoff Shannon

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 rep...@bugs.python.org
http://bugs.python.org/issue22865
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com