Skip to content

Commit d099a87

Browse files
committed
[REVERTME] test regression
1 parent 7e2f7b9 commit d099a87

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

uvicorn/protocols/http/h11_impl.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import asyncio
4-
import contextvars
54
import http
65
import logging
76
from typing import Any, Callable, Literal, cast
@@ -248,12 +247,7 @@ def handle_events(self) -> None:
248247
message_event=asyncio.Event(),
249248
on_response=self.on_response_complete,
250249
)
251-
# For the asyncio loop, we need to explicitly start with an empty context
252-
# as it can be polluted from previous ASGI runs.
253-
# See https://github.com/python/cpython/issues/140947 for details.
254-
task = contextvars.Context().run(self.loop.create_task, self.cycle.run_asgi(app))
255-
# TODO: Replace the line above with the line below for Python >= 3.11
256-
# task = self.loop.create_task(self.cycle.run_asgi(app), context=contextvars.Context())
250+
task = self.loop.create_task(self.cycle.run_asgi(app))
257251
task.add_done_callback(self.tasks.discard)
258252
self.tasks.add(task)
259253

uvicorn/protocols/http/httptools_impl.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import asyncio
4-
import contextvars
54
import http
65
import logging
76
import re
@@ -288,12 +287,7 @@ def on_headers_complete(self) -> None:
288287
)
289288
if existing_cycle is None or existing_cycle.response_complete:
290289
# Standard case - start processing the request.
291-
# For the asyncio loop, we need to explicitly start with an empty context
292-
# as it can be polluted from previous ASGI runs.
293-
# See https://github.com/python/cpython/issues/140947 for details.
294-
task = contextvars.Context().run(self.loop.create_task, self.cycle.run_asgi(app))
295-
# TODO: Replace the line above with the line below for Python >= 3.11
296-
# task = self.loop.create_task(self.cycle.run_asgi(app), context=contextvars.Context())
290+
task = self.loop.create_task(self.cycle.run_asgi(app))
297291
task.add_done_callback(self.tasks.discard)
298292
self.tasks.add(task)
299293
else:

0 commit comments

Comments
 (0)