Browse Source

♻️ Remove Python 3.9 specific logic

pull/14897/head
Sebastián Ramírez 5 months ago
parent
commit
1d76345f98
  1. 3
      fastapi/_compat/shared.py
  2. 3
      fastapi/dependencies/utils.py

3
fastapi/_compat/shared.py

@ -21,9 +21,6 @@ from typing_extensions import TypeGuard, get_args, get_origin
_T = TypeVar("_T")
# Copy from Pydantic: pydantic/_internal/_typing_extra.py
if sys.version_info < (3, 10):
WithArgsTypes: tuple[Any, ...] = (typing._GenericAlias, types.GenericAlias) # type: ignore[attr-defined]
else:
WithArgsTypes: tuple[Any, ...] = (
typing._GenericAlias, # type: ignore[attr-defined]
types.GenericAlias,

3
fastapi/dependencies/utils.py

@ -199,7 +199,6 @@ def get_flat_params(dependant: Dependant) -> list[ModelField]:
def _get_signature(call: Callable[..., Any]) -> inspect.Signature:
if sys.version_info >= (3, 10):
try:
signature = inspect.signature(call, eval_str=True)
except NameError:
@ -211,8 +210,6 @@ def _get_signature(call: Callable[..., Any]) -> inspect.Signature:
signature = inspect.signature(call, annotation_format=Format.FORWARDREF)
else:
signature = inspect.signature(call)
else:
signature = inspect.signature(call)
return signature

Loading…
Cancel
Save