[Python-checkins] r82075 - in python/trunk/Lib: subprocess.py test/test_subprocess.py

jean-paul.calderone python-checkins at python.org
Fri Jun 18 22:00:17 CEST 2010


Author: jean-paul.calderone
Date: Fri Jun 18 22:00:17 2010
New Revision: 82075

Log:
Revert r60115

This revision introduced quoting for strings containing | based
on a misunderstanding of the commonly used quoting rules used
on Windows.

| is interpreted by cmd.exe, not by the MS C runtime argv initializer.
It only needs to be quoted if it is part of an argument passed through
cmd.exe.

See issue1300, issue7839, and issue8972.


Modified:
   python/trunk/Lib/subprocess.py
   python/trunk/Lib/test/test_subprocess.py

Modified: python/trunk/Lib/subprocess.py
==============================================================================
--- python/trunk/Lib/subprocess.py	(original)
+++ python/trunk/Lib/subprocess.py	Fri Jun 18 22:00:17 2010
@@ -548,8 +548,8 @@
 
     2) A string surrounded by double quotation marks is
        interpreted as a single argument, regardless of white space
-       or pipe characters contained within.  A quoted string can be
-       embedded in an argument.
+       contained within.  A quoted string can be embedded in an
+       argument.
 
     3) A double quotation mark preceded by a backslash is
        interpreted as a literal double quotation mark.
@@ -577,7 +577,7 @@
         if result:
             result.append(' ')
 
-        needquote = (" " in arg) or ("\t" in arg) or ("|" in arg) or not arg
+        needquote = (" " in arg) or ("\t" in arg) or not arg
         if needquote:
             result.append('"')
 

Modified: python/trunk/Lib/test/test_subprocess.py
==============================================================================
--- python/trunk/Lib/test/test_subprocess.py	(original)
+++ python/trunk/Lib/test/test_subprocess.py	Fri Jun 18 22:00:17 2010
@@ -486,8 +486,6 @@
                          '"a\\\\b\\ c" d e')
         self.assertEqual(subprocess.list2cmdline(['ab', '']),
                          'ab ""')
-        self.assertEqual(subprocess.list2cmdline(['echo', 'foo|bar']),
-                         'echo "foo|bar"')
 
 
     def test_poll(self):


More information about the Python-checkins mailing list