Merge branch 'stable'

This commit is contained in:
David Lord 2025-03-30 13:17:17 -07:00
commit b78b5a210b
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926
21 changed files with 89 additions and 112 deletions

View file

@ -265,9 +265,9 @@ class Flask(App):
# For one, it might be created while the server is running (e.g. during
# development). Also, Google App Engine stores static files somewhere
if self.has_static_folder:
assert (
bool(static_host) == host_matching
), "Invalid static_host/host_matching combination"
assert bool(static_host) == host_matching, (
"Invalid static_host/host_matching combination"
)
# Use a weakref to avoid creating a reference cycle between the app
# and the view function (see #3761).
self_ref = weakref.ref(self)

View file

@ -684,7 +684,9 @@ class FlaskGroup(AppGroup):
return super().make_context(info_name, args, parent=parent, **extra)
def parse_args(self, ctx: click.Context, args: list[str]) -> list[str]:
if not args and self.no_args_is_help:
if (not args and self.no_args_is_help) or (
len(args) == 1 and args[0] in self.get_help_option_names(ctx)
):
# Attempt to load --env-file and --app early in case they
# were given as env vars. Otherwise no_args_is_help will not
# see commands from app.cli.

View file

@ -58,9 +58,9 @@ class EnvironBuilder(werkzeug.test.EnvironBuilder):
) -> None:
assert not (base_url or subdomain or url_scheme) or (
base_url is not None
) != bool(
subdomain or url_scheme
), 'Cannot pass "subdomain" or "url_scheme" with "base_url".'
) != bool(subdomain or url_scheme), (
'Cannot pass "subdomain" or "url_scheme" with "base_url".'
)
if base_url is None:
http_host = app.config.get("SERVER_NAME") or "localhost"

View file

@ -1,5 +1,6 @@
from __future__ import annotations
import collections.abc as cabc
import typing as t
if t.TYPE_CHECKING: # pragma: no cover
@ -17,6 +18,8 @@ ResponseValue = t.Union[
t.Mapping[str, t.Any],
t.Iterator[str],
t.Iterator[bytes],
cabc.AsyncIterable[str], # for Quart, until App is generic.
cabc.AsyncIterable[bytes],
]
# the possible types for an individual HTTP header