Skip to content

test_py36_class_syntax_usage fails on py 3.14.0a6 #65

Open

Description

@GrimmTheShrimp
=================================== FAILURES ===================================
_________________ TypedDictTests.test_py36_class_syntax_usage __________________

self = <testextensions.TypedDictTests testMethod=test_py36_class_syntax_usage>

    def test_py36_class_syntax_usage(self):
        self.assertEqual(LabelPoint2D.__name__, 'LabelPoint2D')  # noqa
        self.assertEqual(LabelPoint2D.__module__, __name__)  # noqa
>       self.assertEqual(LabelPoint2D.__annotations__, {'x': int, 'y': int, 'label': str})  # noqa
E       AssertionError: {'label': <class 'str'>} != {'x': <class 'int'>, 'y': <class 'int'>, 'label': <class 'str'>}
E       - {'label': <class 'str'>}
E       + {'label': <class 'str'>, 'x': <class 'int'>, 'y': <class 'int'>}

tests/testextensions.py:105: AssertionError
=========================== short test summary info ============================
FAILED tests/testextensions.py::TypedDictTests::test_py36_class_syntax_usage - AssertionError: {'label': <class 'str'>} != {'x': <class 'int'>, 'y': <clas...
========================= 1 failed, 11 passed in 0.08s =========================

Found while building both mypy-extensions 1.0.0 and 1.1.0 on NixOS.
Building against python 3.14.0a6. Python 3.14 is expected to release 2025-10-07, so there is still time to fix this.
I understand python 3.14 is currently an alpha, but it imo it makes sense to report these things as early as they are found.

Activity

  1. cdce8p commented on May 1, 2025

    @cdce8p
    Contributor

    This looks like it's related to the PEP 649 implementation in Python 3.14.
    /CC @JelleZijlstra

  2. JelleZijlstra commented on May 1, 2025

    @JelleZijlstra
    Member

    This is because mypy_extensions.TypedDict looks at __annotations__ in the class dict, which no longer works.

    The easiest fix would be to just re-export typing.TypedDict on newer Python versions.

  3. cdce8p commented on May 1, 2025

    @cdce8p
    Contributor

    The easiest fix would be to just re-export typing.TypedDict on newer Python versions.

    Ideally yes, however support for the keyword-argument syntax was removed in 3.13 which is still "supported" here.

    with self.assert_typeddict_deprecated():
    Emp = TypedDict('Emp', name=str, id=int)

  4. JelleZijlstra commented on May 1, 2025

    @JelleZijlstra
    Member

    Another fix would be to apply the changes to typing.TypedDict from 3.14 to this implementation.

  5. mtelka commented on Nov 26, 2025

    @mtelka

    Is this just a problem in the test and so is it safe to ignore the test failure on Python 3.14? Or, is there a real bug in mypy_extensions that should be fixed?

  6. JelleZijlstra commented on Nov 26, 2025

    @JelleZijlstra
    Member

    It's a real bug in a sense, but it only matters if you (a) use mypy_extensions.TypedDict (which you shouldn't; it's been in typing and typing_extensions for a long time) and (b) rely on runtime introspection of its __annotations__.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions