diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-15 10:06:52 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-15 10:06:52 (GMT) |
commit | 61eda7260ac9fcdb6c5f066eb48dc344544bdfa6 (patch) | |
tree | 9beae3f1525cc5b9e43774bcdc62dd23950988fb /Lib/shlex.py | |
parent | 2e1b6ea4b7b2ca2c9deab8bc7737b1337bdb192a (diff) | |
download | cpython-61eda7260ac9fcdb6c5f066eb48dc344544bdfa6.zip cpython-61eda7260ac9fcdb6c5f066eb48dc344544bdfa6.tar.gz cpython-61eda7260ac9fcdb6c5f066eb48dc344544bdfa6.tar.bz2 |
Fixed #29132: Updated shlex to work better with punctuation chars in POSIX mode.
Thanks to Evan_ for the report and patch.
Diffstat (limited to 'Lib/shlex.py')
-rw-r--r-- | Lib/shlex.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/shlex.py b/Lib/shlex.py index e87266f..2c9786c 100644 --- a/Lib/shlex.py +++ b/Lib/shlex.py @@ -232,11 +232,6 @@ class shlex: break # emit current token else: continue - elif self.posix and nextchar in self.quotes: - self.state = nextchar - elif self.posix and nextchar in self.escape: - escapedstate = 'a' - self.state = nextchar elif self.state == 'c': if nextchar in self.punctuation_chars: self.token += nextchar @@ -245,6 +240,11 @@ class shlex: self._pushback_chars.append(nextchar) self.state = ' ' break + elif self.posix and nextchar in self.quotes: + self.state = nextchar + elif self.posix and nextchar in self.escape: + escapedstate = 'a' + self.state = nextchar elif (nextchar in self.wordchars or nextchar in self.quotes or self.whitespace_split): self.token += nextchar |