New submission from Toshio Kuratomi <[email protected]>:
I have a compatibility module for subprocess in python-2.7 for people who are
stuck on python-2.4 (without check_call) and they got a traceback from trying
to use compat.subprocess.list2cmdline().
In order to use the stdlib's subprocess if it's of a recent enough version, I
check the version and import the symbols from there using from subprocess
import * in the compat module. Unfortunately, one of the people is using
list2cmdline() in their code and list2cmdline() is not in __all__. Comparing
the output, there's a few things not in __all__ in both python-2.7 and in
python-3.1:
(From python-2.7, but python-3.1 boils down to the same list):
>>> sorted([d for d in dir (subprocess) if not d.startswith('_')])
['CalledProcessError', 'MAXFD', 'PIPE', 'Popen', 'STDOUT', 'call',
'check_call', 'check_output', 'errno', 'fcntl', 'gc', 'list2cmdline',
'mswindows', 'os', 'pickle', 'select', 'signal', 'sys', 'traceback', 'types']
>>> sorted(subprocess.__all__)
['CalledProcessError', 'PIPE', 'Popen', 'STDOUT', 'call', 'check_call',
'check_output']
So, MAXFD, list2cmdline, and mswindows seem to be left out.
These could either be made private (prepend with "_"), or added to __all__ to
resolve this bug. (I note that searching for "subprocess.any of those three"
leads to some hits so whether or not they're intended to be public, they are
being used :-(
----------
components: Library (Lib)
messages: 125468
nosy: a.badger
priority: normal
severity: normal
status: open
title: subprocess __all__ is incomplete
versions: Python 2.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10838>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com