summaryrefslogtreecommitdiff
path: root/textproc/py-feedparser5/patches/patch-feedparser_feedparser.py
blob: e9599bbdb4c07646c286810a9583f83d928e702c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$NetBSD: patch-feedparser_feedparser.py,v 1.1 2021/08/19 19:21:00 nia Exp $

Fix compatibility with Python 3.9.

Backported from:
https://github.com/kurtmckee/feedparser/pull/206
https://bugzilla.redhat.com/show_bug.cgi?id=1807186

--- feedparser/feedparser.py.orig	2015-07-24 05:00:04.000000000 +0000
+++ feedparser/feedparser.py
@@ -90,7 +90,10 @@ except ImportError:
     base64 = binascii = None
 else:
     # Python 3.1 deprecates decodestring in favor of decodebytes
-    _base64decode = getattr(base64, 'decodebytes', base64.decodestring)
+    try:
+        _base64decode = base64.decodebytes
+    except AttributeError:
+        _base64decode = 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