-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
latest mypy 0.990 crashes with SQLAlchemy main #14027
Comments
Thanks for testing! I'll take a look at fixing this. I'll also add sqlalchemy main to mypy_primer |
this is a good idea, SQLAlchemy pushes the typing system very hard |
this patch in SQLAlchemy replaces the problematic code that Mypy crashes on and the crash seems to be avoided diff --git a/lib/sqlalchemy/orm/bulk_persistence.py b/lib/sqlalchemy/orm/bulk_persistence.py
index 651533db6a..1640554678 100644
--- a/lib/sqlalchemy/orm/bulk_persistence.py
+++ b/lib/sqlalchemy/orm/bulk_persistence.py
@@ -19,7 +19,7 @@ from typing import cast
from typing import Dict
from typing import Iterable
from typing import Optional
-from typing import overload
+from typing import overload, Callable
from typing import TYPE_CHECKING
from typing import TypeVar
from typing import Union
@@ -883,11 +883,15 @@ class BulkUDCompileState(ORMDMLState):
crit += cls._adjust_for_extra_criteria(global_attributes, mapper)
if crit:
- eval_condition = evaluator_compiler.process(*crit)
+ eval_condition: Callable[..., bool] = evaluator_compiler.process(
+ *crit
+ )
else:
-
- def eval_condition(obj):
+ # workaround for both pylance complaining as well as
+ # mypy https://github.com/python/mypy/issues/14027
+ def _eval_condition(obj):
return True
+ eval_condition = _eval_condition
return eval_condition
|
mypy introduces a crash we need to work around, also some new rules. It also has either a behavioral change regarding how output is rendered in relationship to files being within sys.path or not, so work around that for test_mypy_plugin_py3k.py References: python/mypy#14027 Change-Id: I689c7fe27dc52abee932de9e0fb23b2a2eba76fa
Thanks! Here's a minimal repro:
(will probably get time to actually try to fix over the weekend) Further simplifies to:
|
running mypy or dmypy on SQLAlchemy main branch crashes reliably for the new 0.990 release . For the run below, I have SQLAlchemy checked out on the rel_2_0_0b3 branch so that the results should stay the same regardless of when we make new commits to main. Same issue reproduces with mypy git master.
The text was updated successfully, but these errors were encountered: