-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Mypy crashes when importing types_aiobotocore_s3
#16498
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
Comments
Hmm, I can't reproduce locally on py311 or py312 |
I'm running into same issue with Python 3.11.6 and mypy 1.4.1 in a real project, but I was able to reproduce the issue using the instructions above with Python 3.12.0 and mypy 1.7.0. Note that |
Reproduces for me in a clean venv. I reduced it to a single file: from typing import NotRequired, TypedDict
from thismoduledoesntexist import TransferConfig
B = TypedDict(
"B",
{
"Config": NotRequired[TransferConfig],
},
)
The problem seems to be a NotRequired containing an unimported type inside an old-stype TypedDict (class-style TypedDicts are fine). |
Also reproduces as far back as mypy 1.4.1 (as @miikka wrote). I haven't tried to see how far back it reproduces, but it's not a recent regression. |
Oh, I can reproduce with compiled mypy, but not uncompiled mypy (I was using uncompiled mypy). Because it's one of those runtime checks inserted by mypyc that's failing. Fun. |
FWIW, here's how to get it to repro with uncompiled mypy: apply this diff to diff --git a/mypy/types.py b/mypy/types.py
index e7738bd7d..3eabce15d 100644
--- a/mypy/types.py
+++ b/mypy/types.py
@@ -3076,8 +3076,9 @@ def get_proper_type(typ: Type | None) -> ProperType | None:
typ = typ.type_guard
while isinstance(typ, TypeAliasType):
typ = typ._expand_once()
+ assert isinstance(typ, ProperType), type(typ)
# TODO: store the name of original type alias on this type, so we can show it in errors.
- return cast(ProperType, typ)
+ return typ |
types_aiobotocore_s3
types_aiobotocore_s3
Fixes #16498 Fix is trivial: no operations can be done with `Required` types before unwrapping (because they are not real types). --------- Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Crash report
Mypy 1.7.0 crashes when importing the most recent version of
types_aiobotocore_s3
(2.7.0).To reproduce:
I have the following file:
I'm getting a Mypy crash when running the following command:
Getting same crash on mypy master branch.
Traceback
Your Environment
1.7.0
--show-traceback --disallow-any-unimported
mypy.ini
(and other config files): Nonepython:3.11.6-slim-bullseye
The text was updated successfully, but these errors were encountered: