[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-12-24 Thread miss-islington


miss-islington  added the comment:


New changeset 7acfe4125725e86c982300cf10c0ab791a0783f4 by Miss Islington (bot) 
in branch '3.9':
bpo-42388: Fix subprocess.check_output input=None when text=True (GH-23467)
https://github.com/python/cpython/commit/7acfe4125725e86c982300cf10c0ab791a0783f4


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-12-24 Thread miss-islington


miss-islington  added the comment:


New changeset d5aadb28545fd15cd3517b604a8c7a520abd09c6 by Miss Islington (bot) 
in branch '3.8':
bpo-42388: Fix subprocess.check_output input=None when text=True (GH-23467)
https://github.com/python/cpython/commit/d5aadb28545fd15cd3517b604a8c7a520abd09c6


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-12-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Meta issue behind this one: The input= behavior on check_output is yet another 
unfortunate wart in the subprocess collection of APIs.

PR to the main branch is in, 3.9 and 3.8 will automerge after CI runs.

--
resolution:  -> fixed
stage: patch review -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-12-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22785
pull_request: https://github.com/python/cpython/pull/23935

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-12-24 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +22784
pull_request: https://github.com/python/cpython/pull/23934

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-12-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 64abf373444944a240274a9b6d66d1cb01ecfcdd by Gregory P. Smith in 
branch 'master':
bpo-42388: Fix subprocess.check_output input=None when text=True (GH-23467)
https://github.com/python/cpython/commit/64abf373444944a240274a9b6d66d1cb01ecfcdd


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-11-22 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-11-22 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

It was a mere oversight that this didn't handle text= the same as 
universal_newlines=.  I made a PR to keep their behavior consistent and match 
the documentation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-11-22 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
keywords: +patch
pull_requests: +22357
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23467

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-11-22 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

> (probably can't even limit that to the case when `text` is used, since it was 
> added in 3.7)

Well, actually, we can, since we probably don't need to preserve compatibility 
with the AttributeError currently caused by `text=True` with `input=None`. 
However, it seems to me that treating `input=None` differently depending on the 
other arguments would be confusing.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-11-22 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

It seems that allowing `input=None` to mean "redirect stdin to a pipe and send 
an empty string there" in `subprocess.check_output` was an accident(?), and 
this behavior is inconsistent with `subprocess.run` and `communicate`, where 
`input=None` has the same effect as not specifying it at all.

The docs for `subprocess.check_output` say:

The arguments shown above are merely some common ones. The full function 
signature is largely the same as that of run() - most arguments are passed 
directly through to that interface. However, explicitly passing input=None to 
inherit the parent’s standard input file handle is not supported.

They don't make it clear the effect of passing `input=None` though. I also 
couldn't find any tests that would check that effect.

Since we can't just forbid `input=None` for `check_output` at this point 
(probably can't even limit that to the case when `text` is used, since it was 
added in 3.7), I think that we need to extend the check pointed to by 
ThiefMaster to cover `text`, clarify the docs and add a test.

--
nosy: +gregory.p.smith, izbyshev
versions: +Python 3.10, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42388] subprocess.check_output(['echo', 'test'], text=True, input=None) fails

2020-11-17 Thread ThiefMaster


New submission from ThiefMaster :

`subprocess.check_output(['echo', 'test'], text=True, input=None)` fails with 
`AttributeError: 'bytes' object has no attribute 'encode'` due to the function 
only checking for `universal_newlines` but not `text`: 
https://github.com/python/cpython/blob/2ffba2a1027909e1dd697bf8ec2a03fba7618020/Lib/subprocess.py#L423

This is inconsistent with the docs, which state that "text was added as a more 
readable alias for universal_newlines.".

--
components: Library (Lib)
messages: 381234
nosy: ThiefMaster
priority: normal
severity: normal
status: open
title: subprocess.check_output(['echo', 'test'], text=True, input=None) fails
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com