From 447798f6add0c002ba6bdb3652ed866b493dc934f914f6ef05c6a7bf0dbb8422 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 12 Jul 2023 08:24:22 +0000 Subject: [PATCH] Accepting request 1098186 from home:mcalabkova:branches:devel:languages:python - add upstream py3114.patch OBS-URL: https://build.opensuse.org/request/show/1098186 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyflakes?expand=0&rev=67 --- py3114.patch | 44 +++++++++++++++++++++++++++++++++++++++++ python-pyflakes.changes | 5 +++++ python-pyflakes.spec | 4 +++- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 py3114.patch diff --git a/py3114.patch b/py3114.patch new file mode 100644 index 0000000..2e21bc4 --- /dev/null +++ b/py3114.patch @@ -0,0 +1,44 @@ +From 836631f2f73d45baa4021453d89fc9fd6f52be58 Mon Sep 17 00:00:00 2001 +From: Anthony Sottile +Date: Mon, 12 Jun 2023 21:00:45 -0400 +Subject: [PATCH] fix error reporter and testsuite in 3.11.4+ (#775) + +--- + pyflakes/reporter.py | 3 ++- + pyflakes/test/test_api.py | 8 ++++++-- + 2 files changed, 8 insertions(+), 3 deletions(-) + +Index: pyflakes-3.0.1/pyflakes/reporter.py +=================================================================== +--- pyflakes-3.0.1.orig/pyflakes/reporter.py ++++ pyflakes-3.0.1/pyflakes/reporter.py +@@ -56,8 +56,9 @@ class Reporter: + else: + line = text.splitlines()[-1] + ++ # lineno might be None if the error was during tokenization + # lineno might be 0 if the error came from stdin +- lineno = max(lineno, 1) ++ lineno = max(lineno or 0, 1) + + if offset is not None: + if sys.version_info < (3, 8) and text is not None: +Index: pyflakes-3.0.1/pyflakes/test/test_api.py +=================================================================== +--- pyflakes-3.0.1.orig/pyflakes/test/test_api.py ++++ pyflakes-3.0.1/pyflakes/test/test_api.py +@@ -628,8 +628,12 @@ x = "%s" + x = "%s" + """ % SNOWMAN).encode('utf-16') + with self.makeTempFile(source) as sourcePath: +- self.assertHasErrors( +- sourcePath, [f"{sourcePath}: problem decoding source\n"]) ++ if sys.version_info < (3, 11, 4): ++ expected = f"{sourcePath}: problem decoding source\n" ++ else: ++ expected = f"{sourcePath}:1: source code string cannot contain null bytes\n" # noqa: E501 ++ ++ self.assertHasErrors(sourcePath, [expected]) + + def test_checkRecursive(self): + """ diff --git a/python-pyflakes.changes b/python-pyflakes.changes index 053bc91..34fa6b1 100644 --- a/python-pyflakes.changes +++ b/python-pyflakes.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jul 11 13:45:34 UTC 2023 - Markéta Machová + +- add upstream py3114.patch + ------------------------------------------------------------------- Tue May 9 05:08:00 UTC 2023 - Johannes Kastl diff --git a/python-pyflakes.spec b/python-pyflakes.spec index 6948ede..845d5a6 100644 --- a/python-pyflakes.spec +++ b/python-pyflakes.spec @@ -25,6 +25,8 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/PyCQA/pyflakes Source: https://files.pythonhosted.org/packages/source/p/pyflakes/pyflakes-%{version}.tar.gz +#PATCH-FIX-UPSTREAM https://github.com/PyCQA/pyflakes/commit/836631f2f73d45baa4021453d89fc9fd6f52be58 fix error reporter and testsuite in 3.11.4+ +Patch: py3114.patch BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -42,7 +44,7 @@ works by parsing the source file, not importing it, so it is safe to use on modules with side effects. It's also much faster. %prep -%setup -q -n pyflakes-%{version} +%autosetup -p1 -n pyflakes-%{version} %build %python_build