Bug 2359503 - pyflakes fails to build with Python 3.14: SyntaxError: future feature print_statement is not defined
Summary: pyflakes fails to build with Python 3.14: SyntaxError: future feature print_s...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: pyflakes
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ali Erdinc Koroglu
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-04-14 13:36 UTC by Karolina Surma
Modified: 2025-04-14 13:36 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2025-04-14 13:36:38 UTC
pyflakes fails to build with Python 3.14.0a7.

______________________ TestImports.test_futureImportStar _______________________

self = <pyflakes.test.test_doctests.TestImports testMethod=test_futureImportStar>

    def test_futureImportStar(self):
        """Importing '*' from __future__ fails."""
>       self.flakes('''
        from __future__ import *
        ''', m.FutureFeatureNotDefined)

pyflakes/test/test_imports.py:1001: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyflakes/test/test_doctests.py:45: in flakes
    return super().flakes(self.doctestify(input), *args, **kw)
pyflakes/test/harness.py:27: in flakes
    self.assertEqual(outputs, expectedOutputs, '''\
E   AssertionError: Lists differ: [<class 'pyflakes.messages.DoctestSyntaxError'>] != [<class 'pyflakes.messages.FutureFeatureNotDefined'>]
E   
E   First differing element 0:
E   <class 'pyflakes.messages.DoctestSyntaxError'>
E   <class 'pyflakes.messages.FutureFeatureNotDefined'>
E   
E   - [<class 'pyflakes.messages.DoctestSyntaxError'>]
E   + [<class 'pyflakes.messages.FutureFeatureNotDefined'>] : for input:
E   def doctest_something():
E       """
E          
E          >>> from __future__ import *
E       """
E   
E   expected outputs:
E   [<class 'pyflakes.messages.FutureFeatureNotDefined'>]
E   but got:
E   (none):4:36: syntax error in doctest
____________________ TestImports.test_futureImportUndefined ____________________

self = <pyflakes.test.test_doctests.TestImports testMethod=test_futureImportUndefined>

    def test_futureImportUndefined(self):
        """Importing undefined names from __future__ fails."""
>       self.flakes('''
        from __future__ import print_statement
        ''', m.FutureFeatureNotDefined)

pyflakes/test/test_imports.py:995: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyflakes/test/test_doctests.py:45: in flakes
    return super().flakes(self.doctestify(input), *args, **kw)
pyflakes/test/harness.py:27: in flakes
    self.assertEqual(outputs, expectedOutputs, '''\
E   AssertionError: Lists differ: [<class 'pyflakes.messages.DoctestSyntaxError'>] != [<class 'pyflakes.messages.FutureFeatureNotDefined'>]
E   
E   First differing element 0:
E   <class 'pyflakes.messages.DoctestSyntaxError'>
E   <class 'pyflakes.messages.FutureFeatureNotDefined'>
E   
E   - [<class 'pyflakes.messages.DoctestSyntaxError'>]
E   + [<class 'pyflakes.messages.FutureFeatureNotDefined'>] : for input:
E   def doctest_something():
E       """
E          
E          >>> from __future__ import print_statement
E       """
E   
E   expected outputs:
E   [<class 'pyflakes.messages.FutureFeatureNotDefined'>]
E   but got:
E   (none):4:36: syntax error in doctest
__________________________ Test.test_futureImportStar __________________________

self = <pyflakes.test.test_imports.Test testMethod=test_futureImportStar>

    def test_futureImportStar(self):
        """Importing '*' from __future__ fails."""
>       self.flakes('''
        from __future__ import *
        ''', m.FutureFeatureNotDefined)

pyflakes/test/test_imports.py:1001: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyflakes/test/harness.py:18: in flakes
    tree = ast.parse(textwrap.dedent(input))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = '\nfrom __future__ import *\n', filename = '<unknown>', mode = 'exec'

    def parse(source, filename='<unknown>', mode='exec', *,
              type_comments=False, feature_version=None, optimize=-1):
        """
        Parse the source into an AST node.
        Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
        Pass type_comments=True to get back type comments where the syntax allows.
        """
        flags = PyCF_ONLY_AST
        if optimize > 0:
            flags |= PyCF_OPTIMIZED_AST
        if type_comments:
            flags |= PyCF_TYPE_COMMENTS
        if feature_version is None:
            feature_version = -1
        elif isinstance(feature_version, tuple):
            major, minor = feature_version  # Should be a 2-tuple.
            if major != 3:
                raise ValueError(f"Unsupported major version: {major}")
            feature_version = minor
        # Else it should be an int giving the minor version for 3.x.
>       return compile(source, filename, mode, flags,
                       _feature_version=feature_version, optimize=optimize)
E         File "<unknown>", line 2
E       SyntaxError: future feature * is not defined

/usr/lib64/python3.14/ast.py:50: SyntaxError
_______________________ Test.test_futureImportUndefined ________________________

self = <pyflakes.test.test_imports.Test testMethod=test_futureImportUndefined>

    def test_futureImportUndefined(self):
        """Importing undefined names from __future__ fails."""
>       self.flakes('''
        from __future__ import print_statement
        ''', m.FutureFeatureNotDefined)

pyflakes/test/test_imports.py:995: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyflakes/test/harness.py:18: in flakes
    tree = ast.parse(textwrap.dedent(input))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = '\nfrom __future__ import print_statement\n', filename = '<unknown>'
mode = 'exec'

    def parse(source, filename='<unknown>', mode='exec', *,
              type_comments=False, feature_version=None, optimize=-1):
        """
        Parse the source into an AST node.
        Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
        Pass type_comments=True to get back type comments where the syntax allows.
        """
        flags = PyCF_ONLY_AST
        if optimize > 0:
            flags |= PyCF_OPTIMIZED_AST
        if type_comments:
            flags |= PyCF_TYPE_COMMENTS
        if feature_version is None:
            feature_version = -1
        elif isinstance(feature_version, tuple):
            major, minor = feature_version  # Should be a 2-tuple.
            if major != 3:
                raise ValueError(f"Unsupported major version: {major}")
            feature_version = minor
        # Else it should be an int giving the minor version for 3.x.
>       return compile(source, filename, mode, flags,
                       _feature_version=feature_version, optimize=optimize)
E         File "<unknown>", line 2
E       SyntaxError: future feature print_statement is not defined


https://docs.python.org/3.14/whatsnew/3.14.html

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

For all our attempts to build pyflakes with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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.


Note You need to log in before you can comment on or make changes to this bug.