push preserved contexts in correct order

This commit is contained in:
David Lord 2025-08-18 09:41:03 -07:00
parent 5addaf833b
commit 53b8f08218
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926
3 changed files with 15 additions and 23 deletions

View file

@ -240,10 +240,10 @@ class FlaskClient(Client):
response.json_module = self.application.json # type: ignore[assignment]
# Re-push contexts that were preserved during the request.
while self._new_contexts:
cm = self._new_contexts.pop()
for cm in self._new_contexts:
self._context_stack.enter_context(cm)
self._new_contexts.clear()
return response
def __enter__(self) -> FlaskClient: