New submission from kai zhu <kai...@ugcs.caltech.edu>: 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 ---------- messages: 127714 nosy: kaizhu priority: normal severity: normal status: open title: subprocess popen broken for bytes and backslash type: behavior versions: Python 2.5, Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11095> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com