-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-disallow-anyThe disallow-any-* family of flagsThe disallow-any-* family of flags
Description
I was asked to file a bug with more details; it's possible that the behavior is not as much a bug as increased strictness, but given that it impacts a widely used library, I wanted to share (and ask for recommendations on how proceed since manually ignoring this issue across many projects is going to be tedious).
Minimal program:
Minimal setup:
% python --version
Python 3.12.0
% python3 -m venv .venv
% source .venv/bin/activate
% pip install -U pip mypy pydantic
% pip freeze
annotated-types==0.6.0
mypy==1.7.0
mypy-extensions==1.0.0
pydantic==2.4.2
pydantic_core==2.10.1
typing_extensions==4.8.0
% echo "from pydantic import BaseModel" >> example.py
% echo >> example.py
% echo "class Foo(BaseModel):" >> example.py
% echo " pass" >> example.py
% mypy --disallow-any-explicit --disallow-any-decorated example.py
example.py:3: error: Explicit "Any" is not allowed [misc]
example.py:3: error: Type of decorated function contains type "Any" ("Callable[[DefaultNamedArg(dict[str, Any] | None, '__pydantic_extra__'), DefaultNamedArg(set[str], '__pydantic_fields_set__'), DefaultNamedArg(dict[str, Any] | None, '__pydantic_private__')], None]") [misc]
Found 2 errors in 1 file (checked 1 source file)
These errors are not reproducible with mypy
1.6.1
c0t0ber, alexpovel, macintacos, the21st and WqyJh
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-disallow-anyThe disallow-any-* family of flagsThe disallow-any-* family of flags