From 08d6b77aba1d240e153278f32b304efa50db4268 Mon Sep 17 00:00:00 2001 From: Miro HronĨok Date: Jun 08 2022 16:32:58 +0000 Subject: Upstream fixes for Python 3.11 --- diff --git a/1996.patch b/1996.patch new file mode 100644 index 0000000..43b7b3c --- /dev/null +++ b/1996.patch @@ -0,0 +1,24 @@ +From 7c623444ce7fa3679038b173236a716d100bb92b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 6 Jun 2022 13:25:14 +0200 +Subject: [PATCH] Don't use removed sysconfig.get_config_vars()["SO"] in a + doctest + +This was removed from Python 3.11+, see https://github.com/python/cpython/issues/91670 +--- + pythran/toolchain.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pythran/toolchain.py b/pythran/toolchain.py +index 5a9523903..bb0404466 100644 +--- a/pythran/toolchain.py ++++ b/pythran/toolchain.py +@@ -451,7 +451,7 @@ def compile_pythranfile(file_path, output_file=None, module_name=None, + Specify the output file: + + >>> import sysconfig +- >>> ext = sysconfig.get_config_vars()["SO"] ++ >>> ext = sysconfig.get_config_vars()["EXT_SUFFIX"] + >>> so_path = compile_pythranfile('pythran_test.py', output_file='foo'+ext) + """ + if not output_file: diff --git a/1997.patch b/1997.patch new file mode 100644 index 0000000..1ffb79b --- /dev/null +++ b/1997.patch @@ -0,0 +1,39 @@ +From 821238d492a208c148f802dfd18bf1089dea9f22 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Wed, 8 Jun 2022 18:14:17 +0200 +Subject: [PATCH] Since python 3.11, random.shuffle takes a single argument + +see deprecation notice in https://docs.python.org/3/library/random.html#random.shuffle +Fix #1995 +--- + pythran/tests/test_random.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/pythran/tests/test_random.py b/pythran/tests/test_random.py +index 209ca5b6f1..7c60593727 100644 +--- a/pythran/tests/test_random.py ++++ b/pythran/tests/test_random.py +@@ -1,5 +1,7 @@ + """ Check the random module behavior. """ + from pythran.tests import TestEnv ++from unittest import skipIf ++import sys + + + @TestEnv.module +@@ -109,6 +111,7 @@ def shuffle1(n): + return r != list(range(n)) and sorted(r) == list(range(n))""", + 10, shuffle1=[int]) + ++ @skipIf(sys.version_info >= (3, 11), "no shuffler option since 3.11") + def test_shuffle2(self): + """ Check shuffling with custom function. """ + self.run_test(""" +@@ -119,6 +122,7 @@ def shuffle2(n): + return r != list(range(n)) and sorted(r) == list(range(n))""", + 10 ** 4, shuffle2=[int]) + ++ @skipIf(sys.version_info >= (3, 11), "no shuffler option since 3.11") + def test_shuffle3(self): + """ Check shuffling with random function. """ + self.run_test(""" diff --git a/pythran.spec b/pythran.spec index dd5d058..2649084 100644 --- a/pythran.spec +++ b/pythran.spec @@ -56,6 +56,10 @@ Patch: https://github.com/serge-sans-paille/pythran/pull/1979.patch Patch: https://github.com/serge-sans-paille/pythran/commit/a0571440f5ba08ab3bbfb8aa01831904dfd96815.patch Patch: https://github.com/serge-sans-paille/pythran/commit/8202edbb455be8afdfeb6f9e092c5d36b7aa5c63.patch +# Upstream fixes for Python 3.11 +Patch: https://github.com/serge-sans-paille/pythran/pull/1996.patch +Patch: https://github.com/serge-sans-paille/pythran/pull/1997.patch + %description Pythran is an ahead of time compiler for a subset of the Python language, with a focus on scientific computing. It takes a Python module annotated with a few