From f9c4fe659728b7e55aa707e609498dc20dd087f4 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <bdrung@debian.org>
Date: Sat, 3 Apr 2021 15:44:15 +0200
Subject: [PATCH] Support Python 3.9

Drop Python 2 support and add support for Python 3.9.

Bug: https://bugs.debian.org/986161
Forwarded: https://github.com/stackp/Droopy/pull/31
Signed-off-by: Benjamin Drung <bdrung@debian.org>
---
 droopy | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/droopy b/droopy
index 6f62e13..27fa26d 100755
--- a/droopy
+++ b/droopy
@@ -154,7 +154,7 @@ class DroopyFieldStorage(cgi.FieldStorage):
     def __init__(self, fp=None, headers=None, outerboundary=b'',
                  environ=os.environ, keep_blank_values=0, strict_parsing=0,
                  limit=None, encoding='utf-8', errors='replace',
-                 directory='.'):
+                 max_num_fields=None, separator='&', directory='.'):
         """
         Adds 'directory' argument to FieldStorage.__init__.
         Retains compatibility with FieldStorage.__init__ (which involves magic)
@@ -163,14 +163,15 @@ class DroopyFieldStorage(cgi.FieldStorage):
         # Not only is cgi.FieldStorage full of magic, it's DIFFERENT
         # magic in Py2/Py3. Here's a case of the core library making
         # life difficult, in a class that's *supposed to be subclassed*!
-        if sys.version_info > (3,):
+        if sys.version_info >= (3, 9):
             cgi.FieldStorage.__init__(self, fp, headers, outerboundary,
                                       environ, keep_blank_values,
-                                      strict_parsing, limit, encoding, errors)
+                                      strict_parsing, limit, encoding, errors,
+                                      max_num_fields, separator)
         else:
             cgi.FieldStorage.__init__(self, fp, headers, outerboundary,
                                       environ, keep_blank_values,
-                                      strict_parsing)
+                                      strict_parsing, limit, encoding, errors)
 
     # Binary is passed in Py2 but not Py3.
     def make_file(self, binary=None):
-- 
2.27.0

