Bug 2328015 - python-typeguard fails to build with Python 3.14: typeguard.TypeCheckError: argument "x" (class dummymodule.DummyClass) is not a subclass of dummymodule.DummyClass && AssertionError: Regex pattern did not match.
Summary: python-typeguard fails to build with Python 3.14: typeguard.TypeCheckError: a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-typeguard
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ben Beasley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2024-11-22 11:21 UTC by Karolina Surma
Modified: 2025-02-17 12:04 UTC (History)
6 users (show)

Fixed In Version: python-typeguard-4.4.1-3.fc43 python-typeguard-4.4.2-1.fc42
Clone Of:
Environment:
Last Closed: 2025-02-05 04:25:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github agronholm typeguard issues 502 0 None open Some test regressions on Python 3.14.0a1 2024-11-22 13:01:38 UTC

Description Karolina Surma 2024-11-22 11:21:04 UTC
python-typeguard fails to build with Python 3.14.0a2.

_________________________ TestRecursiveType.test_fail __________________________
/builddir/build/BUILD/python-typeguard-4.4.1-build/python-typeguard-4.4.1/tests/test_checkers.py:1411: in test_fail
    check_type({"a": (1, 2, 3)}, JSONType)
/builddir/build/BUILD/python-typeguard-4.4.1-build/BUILDROOT/usr/lib/python3.14/site-packages/typeguard/_functions.py:107: in check_type
    check_type_internal(value, expected_type, memo)
/builddir/build/BUILD/python-typeguard-4.4.1-build/BUILDROOT/usr/lib/python3.14/site-packages/typeguard/_checkers.py:946: in check_type_internal
    checker(value, origin_type, args, memo)
/builddir/build/BUILD/python-typeguard-4.4.1-build/BUILDROOT/usr/lib/python3.14/site-packages/typeguard/_checkers.py:427: in check_union
    raise TypeCheckError(f"did not match any element in the union:\n{formatted_errors}")
E   typeguard.TypeCheckError: dict did not match any element in the union:
E     str: is not an instance of str
E     float: is neither float or int
E     bool: is not an instance of bool
E     NoneType: is not an instance of NoneType
E     List[annotationlib.JSONType]: is not a list
E     Dict[str, annotationlib.JSONType]: value of key 'a' did not match any element in the union:
E       str: is not an instance of str
E       float: is neither float or int
E       bool: is not an instance of bool
E       NoneType: is not an instance of NoneType
E       List[annotationlib.JSONType]: is not a list
E       Dict[str, annotationlib.JSONType]: is not a dict

During handling of the above exception, another exception occurred:
/builddir/build/BUILD/python-typeguard-4.4.1-build/python-typeguard-4.4.1/tests/test_checkers.py:1392: in test_fail
    with pytest.raises(
E   AssertionError: Regex pattern did not match.
E    Regex: "dict did not match any element in the union:\n  str: is not an instance of str\n  float: is neither float or int\n  bool: is not an instance of bool\n  NoneType: is not an instance of NoneType\n  List\\[JSONType\\]: is not a list\n  Dict\\[str, JSONType\\]: value of key 'a' did not match any element in the union:\n    str: is not an instance of str\n    float: is neither float or int\n    bool: is not an instance of bool\n    NoneType: is not an instance of NoneType\n    List\\[JSONType\\]: is not a list\n    Dict\\[str, JSONType\\]: is not a dict"
E    Input: "dict did not match any element in the union:\n  str: is not an instance of str\n  float: is neither float or int\n  bool: is not an instance of bool\n  NoneType: is not an instance of NoneType\n  List[annotationlib.JSONType]: is not a list\n  Dict[str, annotationlib.JSONType]: value of key 'a' did not match any element in the union:\n    str: is not an instance of str\n    float: is neither float or int\n    bool: is not an instance of bool\n    NoneType: is not an instance of NoneType\n    List[annotationlib.JSONType]: is not a list\n    Dict[str, annotationlib.JSONType]: is not a dict"
_____________________ test_typevar_forwardref[importhook] ______________________
/builddir/build/BUILD/python-typeguard-4.4.1-build/python-typeguard-4.4.1/tests/test_instrumentation.py:333: in test_typevar_forwardref
    instance = dummymodule.typevar_forwardref(dummymodule.DummyClass)
/builddir/build/BUILD/python-typeguard-4.4.1-build/python-typeguard-4.4.1/tests/dummymodule.py:339: in typevar_forwardref
    def typevar_forwardref(x: Type[T]) -> T:
/builddir/build/BUILD/python-typeguard-4.4.1-build/BUILDROOT/usr/lib/python3.14/site-packages/typeguard/_functions.py:137: in check_argument_types
    check_type_internal(value, annotation, memo)
/builddir/build/BUILD/python-typeguard-4.4.1-build/BUILDROOT/usr/lib/python3.14/site-packages/typeguard/_checkers.py:946: in check_type_internal
    checker(value, origin_type, args, memo)
/builddir/build/BUILD/python-typeguard-4.4.1-build/BUILDROOT/usr/lib/python3.14/site-packages/typeguard/_checkers.py:481: in check_class
    check_typevar(value, expected_class, (), memo, subclass_check=True)
/builddir/build/BUILD/python-typeguard-4.4.1-build/BUILDROOT/usr/lib/python3.14/site-packages/typeguard/_checkers.py:538: in check_typevar
    check_type_internal(value, annotation, memo)
/builddir/build/BUILD/python-typeguard-4.4.1-build/BUILDROOT/usr/lib/python3.14/site-packages/typeguard/_checkers.py:946: in check_type_internal
    checker(value, origin_type, args, memo)
/builddir/build/BUILD/python-typeguard-4.4.1-build/BUILDROOT/usr/lib/python3.14/site-packages/typeguard/_checkers.py:504: in check_class
    raise TypeCheckError(f"is not a subclass of {qualified_name(expected_class)}")
E   typeguard.TypeCheckError: argument "x" (class dummymodule.DummyClass) is not a subclass of dummymodule.DummyClass

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/08300782-python-typeguard/

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

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.

Comment 1 Ben Beasley 2024-11-22 13:01:38 UTC
I don’t have an immediate fix for all of the test failures, but I opened an upstream issue https://github.com/agronholm/typeguard/issues/502 to track them, and I note that Jelle Zijlstra started working on Python 3.14 compatibility in https://github.com/agronholm/typeguard/pull/492 (but that PR is not quite ready for 3.14.0a1).

Comment 2 Ben Beasley 2025-01-30 15:01:50 UTC
Upstream now has what seems to be a full fix ready in https://github.com/agronholm/typeguard/pull/492, which I have backported in https://src.fedoraproject.org/rpms/python-typeguard/pull-request/6. Since this is a significant patch and it’s almost time for F42 branching, I plan to merge this for Rawhide/F43 only, once F42 branching is complete.

Comment 3 Fedora Update System 2025-02-05 04:17:22 UTC
FEDORA-2025-8787eae8d1 (python-typeguard-4.4.1-3.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-8787eae8d1

Comment 4 Fedora Update System 2025-02-05 04:25:36 UTC
FEDORA-2025-8787eae8d1 (python-typeguard-4.4.1-3.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2025-02-17 12:00:41 UTC
FEDORA-2025-8f1e4cdfff (python-typeguard-4.4.2-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-8f1e4cdfff

Comment 6 Fedora Update System 2025-02-17 12:04:42 UTC
FEDORA-2025-8f1e4cdfff (python-typeguard-4.4.2-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.


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