-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
Description
Checks
- I added a descriptive title to this issue
- I have searched (google, github) for similar issues and couldn't find anything
- I have read and followed the docs and still think this is a bug
Bug
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
pydantic version: 1.7.3
pydantic compiled: False
install path: /home/user/pydantic/pydantic
python version: 3.9.0 (default, Nov 15 2020, 14:28:56) [GCC 7.3.0]
platform: Linux-5.4.0-65-generic-x86_64-with-glibc2.31
optional deps. installed: ['devtools', 'dotenv', 'email-validator', 'typing-extensions']
Using lenient_issubclass breaks for GernicAlias types.
This is important in python >= 3.9 as the typing become the default for defining types.
Reproducible example:
from pydantic.utils import lenient_issubclass
from collections.abc import Mapping
# should not raise an error here:
assert lenient_issubclass(list[str], Mapping) is Falseraises:
if lenient_issubclass(param.annotation, Request):
\lib\site-packages\pydantic\utils.py:151: in lenient_issubclass
return isinstance(cls, type) and issubclass(cls, class_or_tuple)
\lib\abc.py:102: in __subclasscheck__
return _abc_subclasscheck(cls, subclass)
E TypeError: issubclass() arg 1 must be a class
Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X