[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Richard Oudkerk
Richard Oudkerk added the comment: Firstly, list2cmdline() takes a list as its argument, not a string: import subprocess print subprocess.list2cmdline([r'\1|2\']) \\\1|2\\\ But the problem with passing arguments to a batch file is that cmd.exe parses arguments differently from how

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Piotr Dobrogost
Piotr Dobrogost added the comment: I think you're missing the point. The implementation is wrong as it does not do what documentation says which is A double quotation mark preceded by a backslash is interpreted as a literal double quotation mark. How the output of list2cmdline interacts with

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread R. David Murray
R. David Murray added the comment: This is a only a duplicate of issue 1300 in the sense that that issue points out that list2cmdline has nothing to do with passing/quoting strings for cmd.exe. list2cmdline is an internal function of the subprocess module. Its docstring documents the MS C

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread R. David Murray
R. David Murray added the comment: The first line above is incomplete. I meant that issue 1300 is only a duplicate in the sense that it points out that list2cmdline implements the MS C quoting rules, *not* the cmd.exe quoting rules. -- ___ Python

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Richard Oudkerk
Richard Oudkerk added the comment: I think you're missing the point. The implementation is wrong as it does not do what documentation says which is A double quotation mark preceded by a backslash is interpreted as a literal double quotation mark. That docstring describes how the string

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread R. David Murray
R. David Murray added the comment: The list form of Popen should never be used with shell=True. It would be very good if someone would propose a 'cmd.exe quote' function for the stdlib. But both of these points don't have anything to do with this issue, as far as I can see :) --

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Piotr Dobrogost
Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net: -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18649 ___

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread R. David Murray
R. David Murray added the comment: Using the same rules as the MS C runtime means that, given a sequence (list) of arguments, create a string that uses the same quoting that the MS C runtime uses. That is, if you have a sequence of arguments in a C program, and you want to call another

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Piotr Dobrogost
Piotr Dobrogost added the comment: The docstring starts with this statement Translate a sequence of arguments into a command line string, using the same rules as the MS C runtime: which clearly makes the impression that function list2cmdline uses the same rules as the MS C runtime. However

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-04 Thread Piotr Dobrogost
Piotr Dobrogost added the comment: Sure, something like The purpose of this function is to construct a string which will be later interpreted by MS C runtime as denoting a sequence of arguments. Because of this the string is built in such a way as to preserve the original characters when

[issue18649] list2cmdline function in subprocess module handles \ sequence wrong

2013-08-03 Thread Piotr Dobrogost
New submission from Piotr Dobrogost: According to the docstring of list2cmdline function in subprocess module the sequence of a backslash followed by a double quote mark should denote double quote mark in the output string. However it's not the case Python 2.7.4 (default, Apr 6 2013,