Merge branch '3.0.x'

This commit is contained in:
David Lord 2024-08-23 16:34:57 -07:00
commit 4e6384da32
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926
16 changed files with 112 additions and 104 deletions

View file

@ -47,9 +47,21 @@ def get_load_dotenv(default: bool = True) -> bool:
return val.lower() in ("0", "false", "no")
@t.overload
def stream_with_context(
generator_or_function: t.Iterator[t.AnyStr],
) -> t.Iterator[t.AnyStr]: ...
@t.overload
def stream_with_context(
generator_or_function: t.Callable[..., t.Iterator[t.AnyStr]],
) -> t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]: ...
def stream_with_context(
generator_or_function: t.Iterator[t.AnyStr] | t.Callable[..., t.Iterator[t.AnyStr]],
) -> t.Iterator[t.AnyStr]:
) -> t.Iterator[t.AnyStr] | t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]:
"""Request contexts disappear when the response is started on the server.
This is done for efficiency reasons and to make it less likely to encounter
memory leaks with badly written WSGI middlewares. The downside is that if

View file

@ -113,7 +113,7 @@ def _default(o: t.Any) -> t.Any:
return str(o)
if dataclasses and dataclasses.is_dataclass(o):
return dataclasses.asdict(o)
return dataclasses.asdict(o) # type: ignore[call-overload]
if hasattr(o, "__html__"):
return str(o.__html__())

View file

@ -291,7 +291,7 @@ class App(Scaffold):
instance_path: str | None = None,
instance_relative_config: bool = False,
root_path: str | None = None,
):
) -> None:
super().__init__(
import_name=import_name,
static_folder=static_folder,