]> granicus.if.org Git - python/commitdiff
Patch #102953: Fix bug #125452, where shlex.shlex hangs when it
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 9 Jan 2001 03:01:15 +0000 (03:01 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 9 Jan 2001 03:01:15 +0000 (03:01 +0000)
    encounters a string with an unmatched quote, by adding a check for
    EOF in the 'quotes' state.

Lib/shlex.py

index 6d5659eea89e5bd471ee52b1049383a79a79ed32..7bf81e2caea69b5b0eb81213fa158f3942c27cc5 100644 (file)
@@ -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