Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1927152

Summary: pyflakes fails to build with Python 3.10: test failures
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: pyflakesAssignee: Sandro Bonazzola <sbonazzo>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: code, lbalhar, mhroncok, mrunge, python-sig, sbonazzo, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-06-14 10:38:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1890881    

Description Tomáš Hrnčiar 2021-02-10 08:52:08 UTC
pyflakes fails to build with Python 3.10.0a5.

=================================== FAILURES ===================================
________________________ CheckTests.test_eofSyntaxError ________________________

self = <pyflakes.test.test_api.CheckTests testMethod=test_eofSyntaxError>

        def test_eofSyntaxError(self):
            """
            The error reported for source files which end prematurely causing a
            syntax error reflects the cause for the syntax error.
            """
            with self.makeTempFile("def foo(") as sourcePath:
                if PYPY:
                    result = """\
    %s:1:7: parenthesis is never closed
    def foo(
          ^
    """ % (sourcePath,)
                else:
                    result = """\
    %s:1:9: unexpected EOF while parsing
    def foo(
            ^
    """ % (sourcePath,)
    
>               self.assertHasErrors(
                    sourcePath,
                    [result])

pyflakes/test/test_api.py:483: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyflakes/test/test_api.py:379: in assertHasErrors
    self.assertEqual(
E   AssertionError: Tuples differ: (1, "/tmp/tmpaxh8q5bq:1:8: '(' was never closed\ndef foo(\n       ^\n") != (1, '/tmp/tmpaxh8q5bq:1:9: unexpected EOF while parsing\ndef foo(\n        ^\n')
E   
E   First differing element 1:
E   "/tmp/tmpaxh8q5bq:1:8: '(' was never closed\ndef foo(\n       ^\n"
E   '/tmp/tmpaxh8q5bq:1:9: unexpected EOF while parsing\ndef foo(\n        ^\n'
E   
E   - (1, "/tmp/tmpaxh8q5bq:1:8: '(' was never closed\ndef foo(\n       ^\n")
E   + (1, '/tmp/tmpaxh8q5bq:1:9: unexpected EOF while parsing\ndef foo(\n        ^\n')
_____________________ CheckTests.test_multilineSyntaxError _____________________

self = <pyflakes.test.test_api.CheckTests testMethod=test_multilineSyntaxError>

        def test_multilineSyntaxError(self):
            """
            Source which includes a syntax error which results in the raised
            L{SyntaxError.text} containing multiple lines of source are reported
            with only the last line of that source.
            """
            source = """\
    def foo():
        '''
    
    def bar():
        pass
    
    def baz():
        '''quux'''
    """
    
            # Sanity check - SyntaxError.text should be multiple lines, if it
            # isn't, something this test was unprepared for has happened.
            def evaluate(source):
                exec(source)
            try:
>               evaluate(source)

pyflakes/test/test_api.py:441: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = "def foo():\n    '''\n\ndef bar():\n    pass\n\ndef baz():\n    '''quux'''\n"

    def evaluate(source):
>       exec(source)
E         File "<string>", line 8
E           '''quux'''
E                  ^
E       SyntaxError: unterminated triple-quoted string literal (detected at line 8)

pyflakes/test/test_api.py:439: SyntaxError

During handling of the above exception, another exception occurred:

self = <pyflakes.test.test_api.CheckTests testMethod=test_multilineSyntaxError>

        def test_multilineSyntaxError(self):
            """
            Source which includes a syntax error which results in the raised
            L{SyntaxError.text} containing multiple lines of source are reported
            with only the last line of that source.
            """
            source = """\
    def foo():
        '''
    
    def bar():
        pass
    
    def baz():
        '''quux'''
    """
    
            # Sanity check - SyntaxError.text should be multiple lines, if it
            # isn't, something this test was unprepared for has happened.
            def evaluate(source):
                exec(source)
            try:
                evaluate(source)
            except SyntaxError:
                e = sys.exc_info()[1]
                if not PYPY:
>                   self.assertTrue(e.text.count('\n') > 1)
E                   AssertionError: False is not true

pyflakes/test/test_api.py:445: AssertionError
=========================== short test summary info ============================
FAILED pyflakes/test/test_api.py::CheckTests::test_eofSyntaxError - Assertion...
FAILED pyflakes/test/test_api.py::CheckTests::test_multilineSyntaxError - Ass...
=========== 2 failed, 692 passed, 37 skipped, 3 deselected in 2.71s ============

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01955298-pyflakes/

For all our attempts to build pyflakes with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/pyflakes/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Lumír Balhar 2021-02-17 07:48:59 UTC
Upstream issue: https://github.com/PyCQA/pyflakes/issues/613

Comment 2 Lumír Balhar 2021-02-17 17:10:48 UTC
Upstream says we can send a patch because they usually wait for beta release :)

Comment 3 Miro Hrončok 2021-06-04 20:15:57 UTC
This is a mass-posted update. Sorry if it is not 100% accurate to this bugzilla.


The Python 3.10 rebuild is in progress in a Koji side tag. If you manage to fix the problem, please commit the fix in the rawhide branch, but don't build the package in regular rawhide.

You can either build the package in the side tag, with:

    $ fedpkg build --target=f35-python

Or you can the build and we will eventually build it for you.

Note that the rebuild is still in progress, so not all (build) dependencies of this package might be available right away.

Thanks.

See also https://fedoraproject.org/wiki/Changes/Python3.10

If you have general questions about the rebuild, please use this mailing list thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/G47SGOYIQLRDTWGOSLSWERZSSHXDEDH5/

Comment 4 Ben Beasley 2021-06-07 11:28:44 UTC
Upstream bug is resolved in https://github.com/PyCQA/pyflakes/pull/635.

I have posted a PR that rebases the corresponding commit on the 2.2.0 release and incorporates it as a patch, fixing the Python 3.10 build: https://src.fedoraproject.org/rpms/pyflakes/pull-request/11

Comment 5 Miro Hrončok 2021-06-07 23:00:17 UTC
The f35-python side tag has been merged to Rawhide. From now on, build as you would normally build.

Comment 6 Miro Hrončok 2021-06-14 10:38:16 UTC
This package was successfully rebuilt with Python 3.10.

If you need this bugzilla open for tracking purposes, sorry for the automatic closing: feel free to reopen it.

Comment 7 Miro Hrončok 2021-06-14 10:41:15 UTC
This package was successfully rebuilt with Python 3.10.

If you need this bugzilla open for tracking purposes, sorry for the automatic closing: feel free to reopen it.