diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py index 706533055c..566cf08e7c 100644 --- a/fastapi/dependencies/utils.py +++ b/fastapi/dependencies/utils.py @@ -286,7 +286,7 @@ def get_typed_annotation(annotation: Any, globalns: dict[str, Any]) -> Any: return annotation -def _try_resolve_annotated_string(annotation_str: str, globalns: Dict[str, Any]) -> Any: +def _try_resolve_annotated_string(annotation_str: str, globalns: dict[str, Any]) -> Any: """ Try to partially resolve an Annotated string annotation. diff --git a/tests/test_annotated_forward_ref.py b/tests/test_annotated_forward_ref.py index 6a70d84501..b82547197a 100644 --- a/tests/test_annotated_forward_ref.py +++ b/tests/test_annotated_forward_ref.py @@ -2,15 +2,8 @@ from __future__ import annotations -import sys from dataclasses import dataclass - -# Annotated is available in typing from Python 3.9+ -# For Python 3.8, we need to import from typing_extensions -if sys.version_info >= (3, 9): - from typing import Annotated -else: - from typing import Annotated +from typing import Annotated from fastapi import Depends, FastAPI from fastapi.testclient import TestClient