In the fastapi_di_example.py if we replace the line:
from fastapi import FastAPI, Depends
with
from fastapi import FastAPI, Depends, Request
we get the following stack trace:
File "./fastapi_di_example.py", line 29, in <module>
container.wire(modules=[sys.modules[__name__]])
File "src/dependency_injector/containers.pyx", line 250, in dependency_injector.containers.DynamicContainer.wire
File ".../python-dependency-injector-master/examples/miniapps/fastapi-simple/venv/lib/python3.9/site-packages/dependency_injector/wiring.py", line 242, in wire
_patch_method(member, method_name, method, providers_map)
File ".../python-dependency-injector-master/examples/miniapps/fastapi-simple/venv/lib/python3.9/site-packages/dependency_injector/wiring.py", line 314, in _patch_method
reference_injections, reference_closing = _fetch_reference_injections(fn)
File ".../python-dependency-injector-master/examples/miniapps/fastapi-simple/venv/lib/python3.9/site-packages/dependency_injector/wiring.py", line 352, in _fetch_reference_injections
signature = inspect.signature(fn)
File "/usr/lib/python3.9/inspect.py", line 3130, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/usr/lib/python3.9/inspect.py", line 2879, in from_callable
return _signature_from_callable(obj, sigcls=cls,
File "/usr/lib/python3.9/inspect.py", line 2259, in _signature_from_callable
sig = _signature_from_callable(
File "/usr/lib/python3.9/inspect.py", line 2410, in _signature_from_callable
raise ValueError(
ValueError: no signature found for builtin type <class 'types.GenericAlias'>
Note: fastapi Request object is simply reimported from starlette.
Thanks in advance for your time and props for this great project!
The text was updated successfully, but these errors were encountered:
Fixed in 4.23.1. There already was a similar issue #362 . That seems to be a Python 3.9 bug: inspect fails on inspecting types.GenericAlias builtin class. I have added a workaround to avoid the error. Hope this will get fixed in Python in 3.10.
Hi!
In the fastapi_di_example.py if we replace the line:
from fastapi import FastAPI, Depends
with
from fastapi import FastAPI, Depends, Request
we get the following stack trace:
Note: fastapi Request object is simply reimported from starlette.
Thanks in advance for your time and props for this great project!
The text was updated successfully, but these errors were encountered: