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

KeyError on import with dataclasses with variable length Tuple #935

Closed
stevenkaras opened this issue Jun 6, 2022 · 1 comment · Fixed by python/mypy#13078
Closed

KeyError on import with dataclasses with variable length Tuple #935

stevenkaras opened this issue Jun 6, 2022 · 1 comment · Fixed by python/mypy#13078

Comments

@stevenkaras
Copy link

I ran into this while trying out mypyc and managed to put together a minimal reproduction case:

import dataclasses

@dataclasses.dataclass
class A:
    t: tuple[str, ...]

print(A(t=("hello", "world")).t)

runs as expected with CPython, but when imported after compiling with mypyc fails with:

Python 3.9.6 (default, Aug  6 2021, 00:27:57)
[Clang 12.0.5 (clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sandbox
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sandbox.py", line 6, in <module>
    t: tuple[str, ...]
KeyError: 'tuple'
>>>
ichard26 added a commit to ichard26/mypy that referenced this issue Jul 6, 2022
JelleZijlstra pushed a commit to python/mypy that referenced this issue Jul 12, 2022
@JelleZijlstra
Copy link
Collaborator

Fixed by python/mypy#13078 (thanks @ichard26!)

hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Jul 16, 2022
ilevkivskyi pushed a commit to python/mypy that referenced this issue Jul 16, 2022
…13150)

- Fixes mypyc/mypyc#924
- Fixes mypyc/mypyc#926
- Fixes mypyc/mypyc#935

This is a follow-up of commit 7811f08.

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
Gobot1234 pushed a commit to Gobot1234/mypy that referenced this issue Aug 12, 2022
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.

2 participants