From: Peter Astrand Date: Sat, 13 Jan 2007 22:35:35 +0000 (+0000) Subject: Fix for bug #1634343: allow specifying empty arguments on Windows X-Git-Tag: v2.6a1~2279 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=10514a70ace6ba5b67d2b34dc4c0738d30f51226;p=thirdparty%2FPython%2Fcpython.git Fix for bug #1634343: allow specifying empty arguments on Windows --- diff --git a/Lib/subprocess.py b/Lib/subprocess.py index ea1e0d1e1236..8b25c2fe85c0 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -499,7 +499,7 @@ def list2cmdline(seq): if result: result.append(' ') - needquote = (" " in arg) or ("\t" in arg) + needquote = (" " in arg) or ("\t" in arg) or arg == "" if needquote: result.append('"') diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 64f8d40a40b3..c2db6fab20b7 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -430,6 +430,8 @@ class ProcessTestCase(unittest.TestCase): '"a\\\\b c" d e') self.assertEqual(subprocess.list2cmdline(['a\\\\b\\ c', 'd', 'e']), '"a\\\\b\\ c" d e') + self.assertEqual(subprocess.list2cmdline(['ab', '']), + 'ab ""') def test_poll(self):