From: Peter Astrand Date: Sat, 13 Jan 2007 22:37:11 +0000 (+0000) Subject: Fix for bug #1634343: allow specifying empty arguments on Windows X-Git-Tag: v2.5.1c1~168 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29794ecd43efc2c1b33da2c4e5064f0a1a654342;p=python Fix for bug #1634343: allow specifying empty arguments on Windows --- diff --git a/Lib/subprocess.py b/Lib/subprocess.py index abd790dd92..eb1a735671 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 64f8d40a40..c2db6fab20 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):