From 9d6ec9ac56508d35a0f66eb6747782dbc996735a Mon Sep 17 00:00:00 2001 Message-Id: <9d6ec9ac56508d35a0f66eb6747782dbc996735a.1713446101.git.mdw@distorted.org.uk> From: Mark Wooding Date: Fri, 23 May 2014 18:22:44 +0100 Subject: [PATCH] cgi.py: Don't crash if we have three values for a parameter. Organization: Straylight/Edgeware From: Mark Wooding The first time we see a parameter, we add it to `PARAMDICT'. The second time, we remove it again because it's multivalued. The third time, we try to remove it again, and that fails because it's already gone. --- cgi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cgi.py b/cgi.py index cfa26f7..69b9038 100644 --- a/cgi.py +++ b/cgi.py @@ -419,7 +419,8 @@ def cgiparse(): else: PARAM.append((k, v)) if k in seen: - del PARAMDICT[k] + try: del PARAMDICT[k] + except KeyError: pass else: PARAMDICT[k] = v seen.add(k) -- [mdw]