#11 Backport upstream commit f3b1b44b to fix Python 3.10 build
Merged 2 years ago by churchyard. Opened 2 years ago by music.
rpms/ music/pyflakes python3.10-fix  into  rawhide

@@ -0,0 +1,94 @@ 

+ From 3735b217a7bc167fd0fbf9bec9f240603e9f6a25 Mon Sep 17 00:00:00 2001

+ From: Anthony Sottile <asottile@umich.edu>

+ Date: Thu, 20 May 2021 07:23:19 -0700

+ Subject: [PATCH] fix syntax error offsets for python 3.10 (#635)

+ 

+ ---

+  pyflakes/test/test_api.py | 45 ++++++++++++++++++++++++++-------------

+  1 file changed, 30 insertions(+), 15 deletions(-)

+ 

+ diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py

+ index 128aa69..1639c92 100644

+ --- a/pyflakes/test/test_api.py

+ +++ b/pyflakes/test/test_api.py

+ @@ -441,7 +441,7 @@ def baz():

+              evaluate(source)

+          except SyntaxError:

+              e = sys.exc_info()[1]

+ -            if not PYPY:

+ +            if not PYPY and sys.version_info < (3, 10):

+                  self.assertTrue(e.text.count('\n') > 1)

+          else:

+              self.fail()

+ @@ -449,10 +449,17 @@ def baz():

+          with self.makeTempFile(source) as sourcePath:

+              if PYPY:

+                  message = 'end of file (EOF) while scanning triple-quoted string literal'

+ +            elif sys.version_info >= (3, 10):

+ +                message = 'unterminated triple-quoted string literal (detected at line 8)'  # noqa: E501

+              else:

+                  message = 'invalid syntax'

+  

+ -            column = 8 if sys.version_info >= (3, 8) else 11

+ +            if sys.version_info >= (3, 10):

+ +                column = 12

+ +            elif sys.version_info >= (3, 8):

+ +                column = 8

+ +            else:

+ +                column = 11

+              self.assertHasErrors(

+                  sourcePath,

+                  ["""\

+ @@ -468,21 +475,25 @@ def baz():

+          """

+          with self.makeTempFile("def foo(") as sourcePath:

+              if PYPY:

+ -                result = """\

+ -%s:1:7: parenthesis is never closed

+ -def foo(

+ -      ^

+ -""" % (sourcePath,)

+ +                msg = 'parenthesis is never closed'

+ +            elif sys.version_info >= (3, 10):

+ +                msg = "'(' was never closed"

+              else:

+ -                result = """\

+ -%s:1:9: unexpected EOF while parsing

+ -def foo(

+ -        ^

+ -""" % (sourcePath,)

+ +                msg = 'unexpected EOF while parsing'

+  

+ -            self.assertHasErrors(

+ -                sourcePath,

+ -                [result])

+ +            if PYPY:

+ +                column = 7

+ +            elif sys.version_info >= (3, 10):

+ +                column = 8

+ +            else:

+ +                column = 9

+ +

+ +            spaces = ' ' * (column - 1)

+ +            expected = '{}:1:{}: {}\ndef foo(\n{}^\n'.format(

+ +                sourcePath, column, msg, spaces

+ +            )

+ +

+ +            self.assertHasErrors(sourcePath, [expected])

+  

+      def test_eofSyntaxErrorWithTab(self):

+          """

+ @@ -515,6 +526,10 @@ def foo(bar=baz, bax):

+              if ERROR_HAS_LAST_LINE:

+                  if PYPY and sys.version_info >= (3,):

+                      column = 7

+ +                elif sys.version_info >= (3, 10):

+ +                    column = 18

+ +                elif sys.version_info >= (3, 9):

+ +                    column = 21

+                  elif sys.version_info >= (3, 8):

+                      column = 9

+                  else:

+ -- 

+ 2.31.1

+ 

file modified
+9 -1
@@ -1,7 +1,7 @@ 

  Name:           pyflakes

  # WARNING: When updating pyflakes, check not to break flake8!

  Version:        2.2.0

- Release:        4%{?dist}

+ Release:        5%{?dist}

  Summary:        A simple program which checks Python source files for errors

  

  License:        MIT
@@ -10,6 +10,10 @@ 

  Source0:        %{pypi_source}

  Source1:        http://cdn.debian.net/debian/pool/main/p/pyflakes/pyflakes_2.0.0-1.debian.tar.xz

  Patch0:         %{name}-1.1.0-python3-man.patch

+ # Rebase upstream commit f3b1b44bf3d2d5927004fa1c2fcf1ab2def816b9 “fix syntax

+ # error offsets for python 3.10”, corresponding to upstream PR#635, onto the

+ # 2.2.0 release. See also https://github.com/PyCQA/pyflakes/issues/613.

+ Patch1:         %{name}-2.2.0-f3b1b44bf3d2d5927004fa1c2fcf1ab2def816b9.patch

  

  BuildArch:      noarch

  
@@ -38,6 +42,7 @@ 

  %prep

  %setup -q -a 1

  %patch0 -p1

+ %patch1 -p1

  

  %build

  %py3_build
@@ -74,6 +79,9 @@ 

  %{_mandir}/man1/pyflakes.1*

  

  %changelog

+ * Mon Jun 07 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2.2.0-5

+ - Backport upstream commit f3b1b44b to fix Python 3.10 build (fix RHBZ#1927152)

+ 

  * Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 2.2.0-4

  - Rebuilt for Python 3.10