From 7f98fca157b50708dd2c4848886e18a198e258c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu>
Date: Mon, 9 Mar 2020 13:16:53 +0100
Subject: [PATCH] base64.decodestring() was finally removed in Python 3.8.
---
tests/test_x509.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tests/test_x509.py b/tests/test_x509.py
index 057d7da..138af27 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -15,7 +15,7 @@ import os
import time
import warnings
-from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2 # noqa
+from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2, six # noqa
from tests import unittest
log = logging.getLogger(__name__)
@@ -592,7 +592,10 @@ class X509StackTestCase(unittest.TestCase):
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
- seq = base64.decodestring(b64)
+ if six.PY3:
+ seq = base64.decodebytes(b64)
+ else:
+ seq = base64.decodestring(b64)
stack = X509.new_stack_from_der(seq)
cert = stack.pop()
@@ -612,7 +615,10 @@ class X509StackTestCase(unittest.TestCase):
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
- seq = base64.decodestring(b64)
+ if six.PY3:
+ seq = base64.decodebytes(b64)
+ else:
+ seq = base64.decodestring(b64)
stack = X509.new_stack_from_der(seq)
num = len(stack)
--
2.26.2