diff --git a/619-test-zero-byte.patch b/619-test-zero-byte.patch new file mode 100644 index 0000000..50eee4a --- /dev/null +++ b/619-test-zero-byte.patch @@ -0,0 +1,69 @@ +From a6135542dffb6b1b8254d6daac779d119d4fc08c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= +Date: Wed, 17 May 2023 14:03:26 +0200 +Subject: [PATCH 1/2] Adjust tests to the repr changes in CPython + +--- + tests/test_future/test_backports.py | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/tests/test_future/test_backports.py b/tests/test_future/test_backports.py +index 63b1afea..5d46b115 100644 +--- a/tests/test_future/test_backports.py ++++ b/tests/test_future/test_backports.py +@@ -599,8 +599,12 @@ def test_yaml_linkage(self): + + def test_repr(self): + od = OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]) +- self.assertEqual(repr(od), +- "OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])") ++ if sys.version_info[0] == 3 and sys.version_info[1] >= 12: ++ self.assertEqual(repr(od), ++ "OrderedDict({'c': 1, 'b': 2, 'a': 3, 'd': 4, 'e': 5, 'f': 6})") ++ else: ++ self.assertEqual(repr(od), ++ "OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])") + self.assertEqual(eval(repr(od)), od) + self.assertEqual(repr(OrderedDict()), "OrderedDict()") + +@@ -608,8 +612,12 @@ def test_repr_recursive(self): + # See issue #9826 + od = OrderedDict.fromkeys('abc') + od['x'] = od +- self.assertEqual(repr(od), +- "OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)])") ++ if sys.version_info[0] == 3 and sys.version_info[1] >= 12: ++ self.assertEqual(repr(od), ++ "OrderedDict({'a': None, 'b': None, 'c': None, 'x': ...})") ++ else: ++ self.assertEqual(repr(od), ++ "OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)])") + + def test_setdefault(self): + pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)] + +From d7dc44e88b77fea57b9001421428cd7d95abb3bf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= +Date: Wed, 17 May 2023 14:42:09 +0200 +Subject: [PATCH 2/2] Adjust test to the change in CPython, parser now raises + SyntaxError instead of ValueError when source code contains null bytes + +--- + tests/test_future/test_builtins.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_future/test_builtins.py b/tests/test_future/test_builtins.py +index 3921a608..d41d1254 100644 +--- a/tests/test_future/test_builtins.py ++++ b/tests/test_future/test_builtins.py +@@ -523,8 +523,8 @@ def test_compile(self): + self.assertRaises(TypeError, compile) + self.assertRaises(ValueError, compile, 'print(42)\n', '', 'badmode') + self.assertRaises(ValueError, compile, 'print(42)\n', '', 'single', 0xff) +- # Raises TypeError in Python < v3.5, ValueError in v3.5: +- self.assertRaises((TypeError, ValueError), compile, chr(0), 'f', 'exec') ++ # Raises TypeError in Python < v3.5, ValueError in v3.5, SyntaxError in >= 3.12: ++ self.assertRaises((TypeError, ValueError, SyntaxError), compile, chr(0), 'f', 'exec') + self.assertRaises(TypeError, compile, 'pass', '?', 'exec', + mode='eval', source='0', filename='tmp') + compile('print("\xe5")\n', '', 'exec') diff --git a/python-future.changes b/python-future.changes index aaf412e..b1efb90 100644 --- a/python-future.changes +++ b/python-future.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jul 4 22:14:59 UTC 2023 - Matej Cepl + +- Add 619-test-zero-byte.patch to fix + gh#PythonCharmers/python-future#618. + ------------------------------------------------------------------- Fri Apr 21 12:25:35 UTC 2023 - Dirk Müller diff --git a/python-future.spec b/python-future.spec index f3bedbe..2182976 100644 --- a/python-future.spec +++ b/python-future.spec @@ -33,8 +33,12 @@ Patch1: future-correct-mimetype.patch # PATCH-FIX-UPSTREAM python39-build.patch gh#PythonCharmers/python-future#578 mcepl@suse.com # Overcome incompatibilites with python 3.9 Patch2: python39-build.patch +# PATCH-FIX-UPSTREAM 619-test-zero-byte.patch gh#PythonCharmers/python-future#618 mcepl@suse.com +# incompatibilities with 3.11.4 +Patch3: 619-test-zero-byte.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros %if 0%{suse_version} >= 1550 || (0%{suse_version} == 1500 && 0%{?sle_version} >= 150400) @@ -53,15 +57,14 @@ It allows you to use a single Python 3.x-compatible codebase to support both Python 2 and Python 3. %prep -%setup -q -n future-%{version} -%autopatch -p1 +%autosetup -p1 -n future-%{version} sed -i -e '/^#!\//, 1d' src/future/backports/test/pystone.py %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/futurize %python_clone -a %{buildroot}%{_bindir}/pasteurize