14
0
Files
python-pyflakes/py3114.patch

45 lines
1.7 KiB
Diff

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):
"""