Band-aid fix for newer python in imported module
authorMagnus Hagander <magnus@hagander.net>
Wed, 5 Oct 2022 14:59:19 +0000 (16:59 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 5 Oct 2022 15:00:28 +0000 (17:00 +0200)
hamnadmin/vendor/feedparser/feedparser.py

index 07ed0c8efd7287a922d2c78016af69d9201d9a6a..f121ed516323a0fa901685ab9d37c1c218604d70 100644 (file)
@@ -90,7 +90,9 @@ except ImportError:
     base64 = binascii = None
 else:
     # Python 3.1 deprecates decodestring in favor of decodebytes
-    _base64decode = getattr(base64, 'decodebytes', base64.decodestring)
+    #_base64decode = getattr(base64, 'decodebytes', base64.decodestring)
+    # XXX: python 3.8 *removes* decodestrig, breaking the above, so fix it properly
+    _base64decode = getattr(base64, 'decodebytes') if hasattr(base64, 'decodebytes') else getattr(base64, 'decodestring')
 
 # _s2bytes: convert a UTF-8 str to bytes if the interpreter is Python 3
 # _l2bytes: convert a list of ints to bytes if the interpreter is Python 3