From: Andrew M. Kuchling Date: Tue, 9 Jan 2001 03:01:15 +0000 (+0000) Subject: Patch #102953: Fix bug #125452, where shlex.shlex hangs when it X-Git-Tag: v2.1a1~379 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d56cd100e55b8bdac7cc65edc31687e102702e1;p=python 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. --- diff --git a/Lib/shlex.py b/Lib/shlex.py index 6d5659eea8..7bf81e2cae 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