Bug 2356182 - python-libcst fails to build with Python 3.14: Exception: Logic error, unexpected top level type! when importing libcst.codegen.gen_matcher_classes
Summary: python-libcst fails to build with Python 3.14: Exception: Logic error, unexpe...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-libcst
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Davide Cavalca
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-03-31 10:04 UTC by Karolina Surma
Modified: 2025-03-31 10:04 UTC (History)
4 users (show)

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


Attachments (Terms of Use)

Description Karolina Surma 2025-03-31 10:04:23 UTC
python-libcst fails to build with Python 3.14.0a6.

Check import: libcst.codegen.gen_matcher_classes
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 171, in <module>
    main()
    ~~~~^^
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 167, in main
    import_modules(modules)
    ~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 100, in import_modules
    importlib.import_module(module)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/lib64/python3.14/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1395, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1368, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1339, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 762, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/builddir/build/BUILD/python-libcst-1.7.0-build/BUILDROOT/usr/lib64/python3.14/site-packages/libcst/codegen/gen_matcher_classes.py", line 521, in <module>
    node_fields = list(_get_fields(node))
  File "/builddir/build/BUILD/python-libcst-1.7.0-build/BUILDROOT/usr/lib64/python3.14/site-packages/libcst/codegen/gen_matcher_classes.py", line 425, in _get_fields
    fieldtype, aliases = _get_clean_type_and_aliases(field.type)
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-libcst-1.7.0-build/BUILDROOT/usr/lib64/python3.14/site-packages/libcst/codegen/gen_matcher_classes.py", line 400, in _get_clean_type_and_aliases
    raise Exception("Logic error, unexpected top level type!")
Exception: Logic error, unexpected top level type!

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/08837364-python-libcst/

For all our attempts to build python-libcst with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-libcst/

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.