Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test_py36_class_syntax_usage fails on py 3.14.0a6 #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LordGrimmauld opened this issue Apr 27, 2025 · 4 comments
Open

test_py36_class_syntax_usage fails on py 3.14.0a6 #65

LordGrimmauld opened this issue Apr 27, 2025 · 4 comments

Comments

@LordGrimmauld
Copy link

LordGrimmauld commented Apr 27, 2025

=================================== 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.

LordGrimmauld added a commit to LordGrimmauld/nixpkgs that referenced this issue Apr 27, 2025
Changelog: python/mypy_extensions@1.0.0...1.1.0

The `test_py36_class_syntax_usage` test currently fails on Python 3.14.
It has been disabled for now.

Upstream replaced their `setup.py` why `pyproject.toml` in 6d9c7b756486a654e795095d393bf8206cd11dea [2].
The nix package has been adjusted accordingly.
In the same commit, upstream deprecated Python 3.7 support, and nixpkgs doesn't ship 3.5 or older anymore.
This means the conditional checking for 3.5 or older can be dropped.

The test failure on python 3.11+ [3] was fixed upstream in cd8b0c9c9561d806db4644d772e4ab43279d3d1a [4].

[1] python/mypy_extensions#65
[2] python/mypy_extensions@6d9c7b7
[3] python/mypy_extensions#24
[4] python/mypy_extensions@cd8b0c9
LordGrimmauld added a commit to LordGrimmauld/nixpkgs that referenced this issue Apr 27, 2025
Changelog: python/mypy_extensions@1.0.0...1.1.0

The `test_py36_class_syntax_usage` test currently fails on Python 3.14.
It has been disabled for now.

Upstream replaced their `setup.py` why `pyproject.toml` in 6d9c7b756486a654e795095d393bf8206cd11dea [2].
The nix package has been adjusted accordingly.
In the same commit, upstream deprecated Python 3.7 support, and nixpkgs doesn't ship 3.5 or older anymore.
This means the conditional checking for 3.5 or older can be dropped.

Upstream also implicitly dropped python 2 support: The now-required flit-core does not support python 2.

The test failure on python 3.11+ [3] was fixed upstream in cd8b0c9c9561d806db4644d772e4ab43279d3d1a [4].

[1] python/mypy_extensions#65
[2] python/mypy_extensions@6d9c7b7
[3] python/mypy_extensions#24
[4] python/mypy_extensions@cd8b0c9
@cdce8p
Copy link
Contributor

cdce8p commented May 1, 2025

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

@JelleZijlstra
Copy link
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.

@cdce8p
Copy link
Contributor

cdce8p commented May 1, 2025

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)

@JelleZijlstra
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants