New submission from telmich:

When using argparse and the string \$ occurs on the commandline, it is 
converted to $. This as definitely wrong and renders argparse useless, if the 
input needs to be trusted (i.e. defitinely the same as given into it)'

Example code:

import sys 
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('test', nargs='*')
result = parser.parse_args(sys.argv[1:])

print("args = %s" % " ".join(sys.argv))
print("result = %s" % result)

Reproduce problem:

[10:41] bento:~% python3 argparse-test.py ps1  "PS1='[\t] 
\[\033[1m\]\h\[\033[0m\]:\w\$ '"
] \[\]\h\[\]:\w\$ '"args = argparse-test.py ps1 PS1='[\t] 
\[\033[1m\]\h\[\033[0m\]:\w$ '
result = Namespace(test=['ps1', "PS1='[\\t] 
\\[\\033[1m\\]\\h\\[\\033[0m\\]:\\w$ '"])

[10:40] bento:cdist% python --version
Python 3.3.2

----------
components: Library (Lib)
messages: 201614
nosy: telmich
priority: normal
severity: normal
status: open
title: argparse replaces  \$ to is passed
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19430>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to