New submission from Steve Barnes:
When running under pythonw, or pyinstaller with the -w flag, modules that use subprocess calls such as popen, run, etc. will crash if the default `stdout=None, stderr=None` behaviour is used rather than PIPE. This is an obscure problem which is very hard to debug yet there is no warning in the documentation on this.
I would like to suggest adding a :warning:`stdout=None, stderr=None` must not be used in any of the calls in this module when running under pythonw due to the lack of sys.stdout & sys.stderr in that case. Please use `stdout=PIPE, stderr=PIPE` instead.
A patch against the default branch would be:
diff -r 4243df51fe43 Doc/library/subprocess.rst
--- a/Doc/library/subprocess.rst Fri Feb 10 14:19:36 2017 +0100
+++ b/Doc/library/subprocess.rst Thu Mar 16 16:56:24 2017 +0000
@@ -33,6 +33,13 @@
function for all use cases it can handle. For more advanced use cases, the
underlying :class:`Popen` interface can be used directly.
+.. warning:: Do not use default parameters on Windows with pythonw.
+
+ As pythonw deletes `sys.stdout` & `sys.stderr` the use of the default
+ parameters, `stdout=None, stderr=None,`, which defaults to being
+ `stdout=sys.stdout, stderr=sys.stderr,` may cause unexpected crashes
+ it is recommended to use `stdout=PIPE, stderr=PIPE,` instead.
+
The :func:`run` function was added in Python 3.5; if you need to retain
compatibility with older versions, see the :ref:`call-function-trio` section.
----------
assignee: docs@python
components: Documentation
messages: 289722
nosy: Steve Barnes, docs@python
priority: normal
severity: normal
status: open
title: Documentation lacks clear warning of subprocess issue with pythonw
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue29829>
_______________________________________
New submission from Pablo Galindo Salgado <pablogsal(a)gmail.com>:
The AST docs need some love as they can be a bit obscure to someone new to the module. Improvements to be considered in this issue:
* Document all available nodes (as of 3.8 and not deprecated ones). This helps to know what classes to consider when implementing methods for the visitors.
* Add some short practical examples for the visitors: one to query an AST and another to modify it.
----------
assignee: docs@python
components: Documentation
messages: 359235
nosy: docs@python, pablogsal
priority: normal
severity: normal
status: open
title: Improve the AST documentation
versions: Python 3.9
_______________________________________
Python tracker <report(a)bugs.python.org>
<https://bugs.python.org/issue39199>
_______________________________________
New submission from swanson:
https://docs.python.org/3/reference/expressions.html
in
6.2.9. Yield expressions
end of 1st paragraph:
"Using a yield expression in a function’s body causes that function to be a generator."
NO!
As the very next sentence explains, a generator is what's returned by such a function, not the function itself.
Basically, it should be sufficient to add the word "function" to the end of that sentence: "... generator function." However, this error does NOT exist in 3.0 to 3.2 - just in 3.3 to 3.6, so I suggest just using the same wording as 3.0 to 3.2:
"Using a yield expression in a function definition is sufficient to cause that definition to create a generator function instead of a normal function."
----------
assignee: docs@python
components: Documentation
messages: 246841
nosy: docs@python, swanson
priority: normal
severity: normal
status: open
title: Error in yield expression documentation
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue24650>
_______________________________________
New submission from Xiang Zhang:
https://docs.python.org/3.7/c-api/exceptions.html#c.PyErr_SetFromWindowsErr… it stills refers to PyErr_SetFromWindowsErrWithFilenameObject but this function doesn't exist since Py3.4. I didn't find when and why it's deleted.
And https://docs.python.org/3.4/c-api/exceptions.html#c.PyErr_SetFromWindowsErr raises OSError instead of WindowsError.
----------
assignee: docs@python
components: Documentation
messages: 283814
nosy: docs@python, xiang.zhang
priority: normal
severity: normal
status: open
title: Outdated C api doc about Windows error
versions: Python 3.5, Python 3.6, Python 3.7
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue29045>
_______________________________________
New submission from Ethan Furman:
Not sure if this is a bug, or just One of Those Things:
sys.exit(large_value) can wrap around if the value is too large, but this is O/S dependent.
linux (ubuntu 14.04)
$ python
Python 2.7.8 (default, Oct 20 2014, 15:05:29)
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
--> import sys
--> sys.exit(256)
$ echo $?
0
$ python
Python 2.7.8 (default, Oct 20 2014, 15:05:29)
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
--> import sys
--> sys.exit(257)
$ echo $?
1
M$ (Windows 7)
> python
Python 2.7...
--> import sys
--> sys.exit(65535)
> echo %errorlevel%
65535
> python
Python 2.7...
--> import sys
--> sys.exit(100000)
> echo %errorlevel%
100000
Perhaps a minor doc update that talks about return codes and why they might not be exactly what was given to Python?
----------
assignee: docs@python
messages: 241903
nosy: docs@python, ethan.furman
priority: normal
severity: normal
status: open
title: Behavior of large returncodes (sys.exit(nn))
versions: Python 2.7, Python 3.5
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue24045>
_______________________________________
New submission from Eli Bendersky <eliben(a)gmail.com>:
docs@ list report by Daniel Dieterle:
in the documentation (http://docs.python.org/library/subprocess.html#subprocess.Popen.send_signal) is a bug.
CTRL_C_EVENT can not be sent to processes started with a creationflags parameter which includes CREATE_NEW_PROCESS_GROUP. Why can be read in the msdn documentation http://msdn.microsoft.com/en-us/library/windows/desktop/ms683155%28v=vs.85%… .
A workaround using CTRL_C_EVENT nevertheless is described here:
http://stackoverflow.com/questions/7085604/sending-c-to-python-subprocess-o…
--
I do not know why the subprocess.CREATE_NEW_PROCESS_GROUP parameter was introduced. But it is useless for terminating a process with os.kill() in combination with signal.SIGTERM, which corresponds to a CTRL-C-EVENT.
A CTRL-C-EVENT is only forwarded to the process if the process group is zero. Therefore the Note in the documentation on Popen.send_signal() is wrong.
----------
assignee: docs@python
components: Documentation
messages: 147272
nosy: docs@python, eli.bendersky
priority: normal
severity: normal
status: open
title: Possible problem in documentation of module subprocess, method send_signal
versions: Python 2.7
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue13368>
_______________________________________
New submission from Serhiy Storchaka:
Perhaps almost all Doxygen comments in ElementTree module should be converted to docstrings.
----------
assignee: docs@python
components: Documentation, XML
messages: 179881
nosy: docs@python, eli.bendersky, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Add docstrings for ElementTree module
type: enhancement
versions: Python 3.4
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue16954>
_______________________________________
New submission from Terry J. Reedy:
https://docs.python.org/3/reference/expressions.html#yield-expressions says
"When yield from <expr> is used, it treats the supplied expression
as a subiterator. All values produced by that subiterator ...".
To me "treats..expression as a subiterator" means that the expression must *be* an iterator, such as returned by iter or calling a generator function. Hence I was surprised upon reading "yield from <non-iterator iterable>" in stdlib code.
I confirmed that this usage is correct by trying
>>> def g():
yield from (1,2)
>>> i = g()
>>> next(i), next(i)
(1, 2)
and then reading the PEP380 Formal Semantics, which begins with "_i = iter(EXPR)". Hence I suggest the following replacement for the quote above:
"When yield from <expr> is used, the expression must be an iterable.
A subiterator is obtained with iter(<expr>). All values produced
by that subiterator ...".
Note that 'subiterator' is spelled in the following sentences 'underlying iterable' (which I am not sure I like) and 'sub-iterator' (and 'sub-generator'). I think we should be consistent for at least the two short 'yield from' paragraphs.
----------
assignee: docs@python
components: Documentation
messages: 271577
nosy: docs@python, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: yield from expression can be any iterable
type: behavior
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue27646>
_______________________________________
New submission from Dan Merillat <dan.merillat(a)gmail.com>:
"The interpretation of the flags and the speeds as well as the indexing in the cc array must be done using the symbolic constants defined in the |termios| module." (termios links to itself)
These constants are not listed in the documentation and the termios module is installed as a shared library so you can't read it without going to the source.
Furthermore the example in the documentation uses the following example:
new = termios.tcgetattr(fd)
new[3] = new[3] & ~termios.ECHO # lflags
Which is explicitly against the documentation on the same page.
This has led to most searches on the net turning up people using magic numbers in places instead of symbolic values.
Inserting a list of constants with an extremely brief description would improve the module documentation dramatically.
----------
assignee: docs@python
components: Documentation
messages: 381393
nosy: dan.merillat, docs@python
priority: normal
severity: normal
status: open
title: Termios module documentation is extremely lacking
versions: Python 3.9
_______________________________________
Python tracker <report(a)bugs.python.org>
<https://bugs.python.org/issue42402>
_______________________________________