mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** I'd expect to get a type error when trying to pass a `tuple` to a `Hashable` bound if that tuple contains any non-hashable element type. **To Reproduce** ```py...
closes https://github.com/python/mypy/issues/19108
(edit: `--enable-error-code all` is now "spelled" `--enable-all-error-codes`, thanks to the feedback I received on this PR.) This code change allows users to use `--enable-error-code all` to enable all error codes....
Implements the [TypeForm PEP 747](https://peps.python.org/pep-0747/), as an opt-in feature enabled by the CLI flag `--enable-incomplete-feature=TypeForm`. Implementation approach: * The `TypeForm[T]` is represented as a type using the existing `TypeType` class,...
**Bug Report** mypy warns about the right side of a condition being unreachable when a variable is reset in an outer loop, then set again inside the inner loop. **To...
[1.16 regression] failure to exhaustively narrow type var bounded by union with value pattern match
Courtesy of @delfick So if we have two files ```python # a.py from typing import assert_never import b def switch[T_Choice: b.One | b.Two](choice: type[T_Choice]) -> None: match choice: case b.One:...
This aims to resolve issue #7314 by adding test interactions with the walrus operator (:=) and the --allow-redefinition flag. In order to accomplish what the documentation provides for the flag,...
Adds a type check that disallows assignments to __class__, which can lead to unsafe runtime behavior. Includes tests for __class__ assignments and verifies that other dunder and regular attributes remain...
**Bug Report** ```shell $ mypy --version mypy 1.15.0 (compiled: yes) ``` This version output does not match an existing tag in git. https://github.com/python/mypy/tags https://github.com/python/mypy/releases/tag/v1.15.0 I would expect either the `--version`...
This PR adds 2 new weakref primitives for weakref.proxy (1 and 2 arg) The C code generates correctly, but I'm not entirely sure why this test is failing. The weakly-proxied...