This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kaizhu
Recipients kaizhu
Date 2011-02-02.02:28:40
SpamBayes Score 3.0980774e-13
Marked as misclassified No
Message-id <1296613721.25.0.259420075945.issue11095@psf.upfronthosting.co.za>
In-reply-to
Content
noticed when trying to call grep w/ backslashes in regexp, in shell mode.
same behavior on python2.5 & python3.2

in shell mode:
1. bytes is broken
2. 1st character after backslash is always silently truncated (with exception of '\\')

$ python3.2
Python 3.2rc1+ (py3k, Jan 24 2011, 15:00:02) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.call(b'echo aa', shell = True) ## bytes broken
Traceback (most recent call last):
  File "<pseudosugar console>", line 1, in <module>
  File "/home/public/i486-pc-linux-gnu/lib/python3.2/subprocess.py", line 460, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/home/public/i486-pc-linux-gnu/lib/python3.2/subprocess.py", line 736, in __init__
    restore_signals, start_new_session)
  File "/home/public/i486-pc-linux-gnu/lib/python3.2/subprocess.py", line 1175, in _execute_child
    restore_signals, start_new_session, preexec_fn)
TypeError: Can't convert 'int' object to str implicitly
>>> subprocess.call('echo \aa', shell = True) ## backslash \
a
0
>>> subprocess.call('echo \\aa', shell = True) ## backslash \\
aa
0
>>> subprocess.call('echo \\\aa', shell = True) ## backslash \\\
a
0
>>> subprocess.call('echo \\\\aa', shell = True) ## backslash \\\\
a
0
>>> subprocess.call('echo \\\\\aa', shell = True) ## backslash \\\\\
\a
0
>>> subprocess.call('echo \\\\\\aa', shell = True) ## backslash \\\\\\
a
0
>>> subprocess.call('echo \\\\\\\\\\\\\\\\\\\\\\\\\aa', shell = True)
\\\a
0
History
Date User Action Args
2011-02-02 02:28:41kaizhusetrecipients: + kaizhu
2011-02-02 02:28:41kaizhusetmessageid: <1296613721.25.0.259420075945.issue11095@psf.upfronthosting.co.za>
2011-02-02 02:28:40kaizhulinkissue11095 messages
2011-02-02 02:28:40kaizhucreate