fix comment typos, use not arg instead of arg == "", add test coverage
for inside of the final if needquotes: within subprocess.list2cmdline().
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 29c25bc..a94490c 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -497,7 +497,7 @@
if result:
result.append(' ')
- needquote = (" " in arg) or ("\t" in arg) or arg == ""
+ needquote = (" " in arg) or ("\t" in arg) or not arg
if needquote:
result.append('"')
@@ -506,7 +506,7 @@
# Don't know if we need to double yet.
bs_buf.append(c)
elif c == '"':
- # Double backspaces.
+ # Double backslashes.
result.append('\\' * len(bs_buf)*2)
bs_buf = []
result.append('\\"')
@@ -517,7 +517,7 @@
bs_buf = []
result.append(c)
- # Add remaining backspaces, if any.
+ # Add remaining backslashes, if any.
if bs_buf:
result.extend(bs_buf)