summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2001-01-09 03:01:15 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2001-01-09 03:01:15 (GMT)
commit9d56cd100e55b8bdac7cc65edc31687e102702e1 (patch)
tree4f53316de6464ca3644df97c5ef45cf71b163407 /Lib
parent92d8917f8300267e798df729cf4f28acd83f257f (diff)
downloadcpython-9d56cd100e55b8bdac7cc65edc31687e102702e1.zip
cpython-9d56cd100e55b8bdac7cc65edc31687e102702e1.tar.gz
cpython-9d56cd100e55b8bdac7cc65edc31687e102702e1.tar.bz2
Patch #102953: Fix bug #125452, where shlex.shlex hangs when it
encounters a string with an unmatched quote, by adding a check for EOF in the 'quotes' state.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/shlex.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/shlex.py b/Lib/shlex.py
index 6d5659e..7bf81e2 100644
--- a/Lib/shlex.py
+++ b/Lib/shlex.py
@@ -123,6 +123,11 @@ class shlex:
if nextchar == self.state:
self.state = ' '
break
+ elif not nextchar: # end of file
+ if self.debug >= 2:
+ print "shlex: I see EOF in quotes state"
+ # XXX what error should be raised here?
+ raise ValueError, "No closing quotation"
elif self.state == 'a':
if not nextchar:
self.state = None # end of file