Author a.badger
Recipients a.badger
Date 2011-01-05.20:52:47
SpamBayes Score 1.28977e-06
Marked as misclassified No
Message-id <1294260769.5.0.0970426129524.issue10838@psf.upfronthosting.co.za>
In-reply-to
Content
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 :-(
History
Date User Action Args
2011-01-05 20:52:50a.badgersetrecipients: + a.badger
2011-01-05 20:52:49a.badgersetmessageid: <1294260769.5.0.0970426129524.issue10838@psf.upfronthosting.co.za>
2011-01-05 20:52:47a.badgerlinkissue10838 messages
2011-01-05 20:52:47a.badgercreate