Skip to content
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

test_typeddict_errors fails on python3.11 #24

Closed
mweinelt opened this issue Sep 13, 2022 · 7 comments · Fixed by #28
Closed

test_typeddict_errors fails on python3.11 #24

mweinelt opened this issue Sep 13, 2022 · 7 comments · Fixed by #28

Comments

@mweinelt
Copy link

Heads up, we're seeing a test failure with python 3.11.0rc2 and mypy_extensions. Python 3.11 will be released in October.

======================================================================
FAIL: test_typeddict_errors (testextensions.TypedDictTests.test_typeddict_errors)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/tests/testextensions.py", line 91, in test_typeddict_errors
    with self.assertRaises(TypeError):
AssertionError: TypeError not raised

----------------------------------------------------------------------
Ran 7 tests in 0.003s

FAILED (failures=1)
@gvanrossum
Copy link
Member

I cannot repro this yet. Which version of Python 3.11 did you use? rc2? What platform? What version of mypy? Accelerated through mypyc or not?

@mweinelt
Copy link
Author

mweinelt commented Sep 13, 2022

  • NixOS unstable (x86_64-linux)
  • Python 3.11.0rc2
  • mypy 0.961
    • built using MYPYC_OPT_LEVEL=1
  • mypy_extensions 0.4.3

I'm in the process of updating to mypy 0.971 and can retest if that helps. Except mypy is not part of the environment during testing, so that seems pointless.

@gvanrossum
Copy link
Member

Ah, I was confused. I've confirmed your report on macOS. I didn't try earlier versions of Python 3.11, but the tests pass with 3.10.

Do you have time to debug this further? I'm guessing something in the stdlib typing.py module changed, but I don't have time to investigate further.

@mweinelt
Copy link
Author

Works on 3.11.0a6, broke on 3.11.0a7. I'm not too familiar with the cpython codebase and I don't have a setup ready to bisect this any further.

@gvanrossum
Copy link
Member

@JelleZijlstra -- what could have broken this? It seems to be this code at L91-92 that no longer raises TypeError:

        with self.assertRaises(TypeError):
            TypedDict('Hi', x=1)

A lot of stuff went in between a6 and a7, including PEP 646, and a bunch of refactoring by Serhiy.

@JelleZijlstra
Copy link
Member

I think that's because of 870b22b9c442d035190d2b8fb82256cd9a03da48 (python/cpython#31151).

@gvanrossum
Copy link
Member

So the test should just be fixed.

JukkaL added a commit that referenced this issue Jan 29, 2023
Integers are now accepted as types in many runtime contexts:
python/cpython#90802

Fixes #24.
JukkaL added a commit that referenced this issue Jan 29, 2023
Integers are now accepted as types in many runtime contexts:
python/cpython#90802

Fixes #24.
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

Successfully merging a pull request may close this issue.

3 participants