-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Type error randomly raised when using a decorator and a type: ignore
comment
#18125
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
Thanks! I can reproduce this locally. This is certainly a weird one! So far I've narrowed this down to some non-deterministic behavior of What's quite interesting is that the nondeterministic behavior isn't just between mypy runs, but also between invocations of |
Okay, this is really indeterminate. diff --git a/mypy/solve.py b/mypy/solve.py
index 57988790a..a6d9cfcd7 100644
--- a/mypy/solve.py
+++ b/mypy/solve.py
@@ -214,7 +214,7 @@ def solve_iteratively(
break
# Solve each solvable type variable separately.
s_batch.remove(solvable_tv)
- result = solve_one(lowers[solvable_tv], uppers[solvable_tv])
+ result = solve_one(sorted(lowers[solvable_tv], key=str), sorted(uppers[solvable_tv], key=str))
solutions[solvable_tv] = result
if result is None:
# TODO: support backtracking lower/upper bound choices and order within SCCs. The problematic case is solving the following set of constraints:
for This problem stems from non-commutative join and meet implementation. |
Ah I ran into that in #16979 (comment) as well |
To Reproduce
pydantic==2.9.2
installed.t.py
:mypy --cache-dir=/dev/null --python-version 3.10 --disable-error-code empty-body --warn-unused-ignores t.py
Mypy will randomly raise:
t.py:10: error: Unused "type: ignore" comment [unused-ignore]
And sometimes suceed.
Sorry I couldn't provide more details, the issue is really weird and it seems like mypy doesn't produce fully reproducible results in this case.
Your Environment
--cache-dir=/dev/null --python-version 3.10 --disable-error-code empty-body --warn-unused-ignores
mypy.ini
(and other config files):3.12
The text was updated successfully, but these errors were encountered: