-
-
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
Bug
https://github.com/pawamoy/pytkdocs/pull/41/checks?check_run_id=747827745
pydantic version: 1.5.1
pydantic compiled: False
install path: /home/pawamoy/.cache/pypoetry/virtualenvs/pytkdocs-LMVK1zAi-py3.7/lib/python3.7/site-packages/pydantic
python version: 3.7.5 (default, Apr 27 2020, 16:40:42) [GCC 9.3.0]
platform: Linux-5.6.15-arch1-1-x86_64-with-arch
optional deps. installed: ['typing-extensions']
>>> import typing
>>> import pydantic
>>>
>>> class M(pydantic.BaseModel):
... a: int
...
>>> typing.get_type_hints(M.__config__)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pawamoy/.basher-packages/pyenv/pyenv/versions/3.7.5/lib/python3.7/typing.py", line 976, in get_type_hints
value = _eval_type(value, base_globals, localns)
File "/home/pawamoy/.basher-packages/pyenv/pyenv/versions/3.7.5/lib/python3.7/typing.py", line 265, in _eval_type
ev_args = tuple(_eval_type(a, globalns, localns) for a in t.__args__)
File "/home/pawamoy/.basher-packages/pyenv/pyenv/versions/3.7.5/lib/python3.7/typing.py", line 265, in <genexpr>
ev_args = tuple(_eval_type(a, globalns, localns) for a in t.__args__)
File "/home/pawamoy/.basher-packages/pyenv/pyenv/versions/3.7.5/lib/python3.7/typing.py", line 263, in _eval_type
return t._evaluate(globalns, localns)
File "/home/pawamoy/.basher-packages/pyenv/pyenv/versions/3.7.5/lib/python3.7/typing.py", line 467, in _evaluate
eval(self.__forward_code__, globalns, localns),
File "<string>", line 1, in <module>
NameError: name 'SchemaExtraCallable' is not definedNow you could wonder, "why are you doing this?", and you would be right to do so. Well, I'm writing a package that automatically introspect classes and all their members to output structured data in JSON (it's pytkdocs, used by mkdocstrings to bring autodoc for MkDocs, and pytkdocs tries to support Pydantic models).
I'm just reporting for the sake of it. Maybe there's an easy fix? Maybe it's a bug in Python's typing? Maybe it's expected because SchemaExtraCallable is a forward ref in this context?
Anyway, I'm catching the error for now, so it's fine if you want to close the issue 🙂
Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X