From a60cde3d7b6115bd9a8a871c356a47cbcb44e934 Mon Sep 17 00:00:00 2001 From: Moshe Zadka Date: Sat, 31 Mar 2001 08:42:37 +0000 Subject: Fixing #125452 - shlex.shlex hangs when it encounters a string with an unmatched quote --- Lib/shlex.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/shlex.py b/Lib/shlex.py index fd7535a..c4cfc78 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 -- cgit v0.12