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
This commit is contained in:
Matej Cepl 2023-07-12 08:24:22 +00:00 committed by Git OBS Bridge
parent 3a01415712
commit 447798f6ad
3 changed files with 52 additions and 1 deletions

44
py3114.patch Normal file
View File

@ -0,0 +1,44 @@
From 836631f2f73d45baa4021453d89fc9fd6f52be58 Mon Sep 17 00:00:00 2001
From: Anthony Sottile <asottile@umich.edu>
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):
"""

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jul 11 13:45:34 UTC 2023 - Markéta Machová <mmachova@suse.com>
- add upstream py3114.patch
-------------------------------------------------------------------
Tue May 9 05:08:00 UTC 2023 - Johannes Kastl <kastl@b1-systems.de>

View File

@ -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