]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
✏️ Fix typos in comment in `fastapi/applications.py` (#10045)
authorAhsan Sheraz <ahsansheraz250@gmail.com>
Sat, 2 Sep 2023 15:37:40 +0000 (20:37 +0500)
committerGitHub <noreply@github.com>
Sat, 2 Sep 2023 15:37:40 +0000 (17:37 +0200)
fastapi/applications.py

index b681e50b395d7225224e72fc963ae9eaaf6f49e0..5cc568292490908b758c9e1ec2189ab97c62b01f 100644 (file)
@@ -189,20 +189,20 @@ class FastAPI(Starlette):
                 # contextvars.
                 # This needs to happen after user middlewares because those create a
                 # new contextvars context copy by using a new AnyIO task group.
-                # The initial part of dependencies with yield is executed in the
-                # FastAPI code, inside all the middlewares, but the teardown part
-                # (after yield) is executed in the AsyncExitStack in this middleware,
-                # if the AsyncExitStack lived outside of the custom middlewares and
-                # contextvars were set in a dependency with yield in that internal
+                # The initial part of dependencies with 'yield' is executed in the
+                # FastAPI code, inside all the middlewares. However, the teardown part
+                # (after 'yield') is executed in the AsyncExitStack in this middleware.
+                # If the AsyncExitStack lived outside of the custom middlewares and
+                # contextvars were set in a dependency with 'yield' in that internal
                 # contextvars context, the values would not be available in the
-                # outside context of the AsyncExitStack.
-                # By putting the middleware and the AsyncExitStack here, inside all
-                # user middlewares, the code before and after yield in dependencies
-                # with yield is executed in the same contextvars context, so all values
-                # set in contextvars before yield is still available after yield as
-                # would be expected.
+                # outer context of the AsyncExitStack.
+                # By placing the middleware and the AsyncExitStack here, inside all
+                # user middlewares, the code before and after 'yield' in dependencies
+                # with 'yield' is executed in the same contextvars context. Thus, all values
+                # set in contextvars before 'yield' are still available after 'yield,' as
+                # expected.
                 # Additionally, by having this AsyncExitStack here, after the
-                # ExceptionMiddleware, now dependencies can catch handled exceptions,
+                # ExceptionMiddleware, dependencies can now catch handled exceptions,
                 # e.g. HTTPException, to customize the teardown code (e.g. DB session
                 # rollback).
                 Middleware(AsyncExitStackMiddleware),