]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add mypy ignore comments for Python 3.14 module imports
authorShamil Abdulaev <ashm.tech@proton.me>
Thu, 16 Apr 2026 18:56:23 +0000 (14:56 -0400)
committersqla-tester <sqla-tester@sqlalchemy.org>
Thu, 16 Apr 2026 18:56:23 +0000 (14:56 -0400)
commit77c91b8df51c5a00d6940a9b63b2ba5bd01d9ceb
treeed753047e11aac284f1ed4802d0f9a5112927253
parent7dce9fec9d2071351d0c003a607955eca5dcf9ae
Add mypy ignore comments for Python 3.14 module imports

Fixes #13240

Use `sys.version_info >= (3, 14)` instead of the `py314` variable for
the py314-only imports block (`annotationlib`, `string.templatelib`).

mypy has built-in support for `sys.version_info` guards and only
type-checks the reachable branch, while a plain variable like `py314`
causes mypy to check both branches — leading to `import-not-found` on
<3.14 and `unused-ignore` on 3.14 if `type: ignore` comments are added.

Closes: #13239
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13239
Pull-request-sha: f58bfc11694c71020b98ed69d8400a0173be096b

Change-Id: Ib5e2361e849a3f14f90d0da34800c1d31f8bf201
lib/sqlalchemy/sql/_elements_constructors.py
lib/sqlalchemy/util/compat.py