From 0272832c8886bd851dea3aaf94b5c30f75c6d6d1 Mon Sep 17 00:00:00 2001 From: Marc Dequènes (Duck) Date: Mar 19 2020 15:14:37 +0000 Subject: Add Python upstream compatibility patch --- diff --git a/mailman3-invalid-url-exception-test-update.patch b/mailman3-invalid-url-exception-test-update.patch new file mode 100644 index 0000000..116e66f --- /dev/null +++ b/mailman3-invalid-url-exception-test-update.patch @@ -0,0 +1,60 @@ +commit c5f524e3e (HEAD -> python-374_fix) +Author: Abhilash Raj +Date: Sat Aug 31 15:38:48 2019 -0700 + + Add fixes for Python 3.7.4 compatibility. + +diff --git a/src/mailman/commands/cli_import.py b/src/mailman/commands/cli_import.py +index cda0bd285..4ebd91363 100644 +--- a/src/mailman/commands/cli_import.py ++++ b/src/mailman/commands/cli_import.py +@@ -34,9 +34,13 @@ from zope.component import getUtility + from zope.interface import implementer + + +-# A fake Bouncer class from Mailman 2.1, we don't use it but there are +-# instances in the .pck files. +-class Bouncer: ++# A fake module to go with `Bouncer`. ++class _Mailman: ++ __path__ = 'src/mailman/commands/cli_import.py' ++ ++# A fake Mailman object with Bouncer class from Mailman 2.1, we don't use it ++# but there are instances in the .pck files. ++class _Bouncer: + class _BounceInfo: + pass + +@@ -56,7 +60,8 @@ def import21(ctx, listspec, pickle_file): + if mlist is None: + ctx.fail(_('No such list: $listspec')) + with ExitStack() as resources: +- resources.enter_context(hacked_sys_modules('Mailman.Bouncer', Bouncer)) ++ resources.enter_context(hacked_sys_modules('Mailman', _Mailman)) ++ resources.enter_context(hacked_sys_modules('Mailman.Bouncer', _Bouncer)) + resources.enter_context(transaction()) + while True: + try: +diff --git a/src/mailman/rest/tests/test_basic.py b/src/mailman/rest/tests/test_basic.py +index 559a0f96d..bd0df73b3 100644 +--- a/src/mailman/rest/tests/test_basic.py ++++ b/src/mailman/rest/tests/test_basic.py +@@ -22,6 +22,7 @@ For example, test the integration between Mailman and Falcon. + + import unittest + ++from http.client import InvalidURL + from mailman.app.lifecycle import create_list + from mailman.database.transaction import transaction + from mailman.testing.helpers import call_api +@@ -53,6 +54,8 @@ class TestBasicREST(unittest.TestCase): + # space in the URL breaks error reporting due to default HTTP/0.9. + # Use urllib.request since requests will encode the URL, defeating the + # purpose of this test (i.e. we want the literal space, not %20). +- with self.assertRaises(HTTPError) as cm: ++ with self.assertRaises((HTTPError, InvalidURL)) as cm: + urlopen('http://localhost:9001/3.0/lists/test @example.com') +- self.assertEqual(cm.exception.code, 400) ++ ++ if isinstance(cm, HTTPError): ++ self.assertEqual(cm.exception.code, 400) diff --git a/mailman3.spec b/mailman3.spec index a6827fc..a25a374 100644 --- a/mailman3.spec +++ b/mailman3.spec @@ -39,7 +39,8 @@ Patch10: %{name}-administrivia-headers.patch Patch11: %{name}-subject-prefix.patch Patch12: %{name}-subject-prefix_tests.patch Patch13: %{name}-tests-content-type-fix.patch -Patch14: mailman3-use-either-importlib_resources-or-directly-importlib.patch +Patch14: %{name}-use-either-importlib_resources-or-directly-importlib.patch +Patch15: %{name}-invalid-url-exception-test-update.patch BuildArch: noarch @@ -290,6 +291,8 @@ done - use importlib.resources instead of importlib_resources is available - fix stale lock preventing mailman3.service from starting (see Debian#919160) +- add upstream patch to fix compatibility with Python 3.7.4 and + Python 3.8b4 * Wed Jan 29 2020 Fedora Release Engineering - 3.2.0-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild