From c34c0f32a7efbf1577b1ce4610312843502912bd Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Wed, 15 Feb 2023 21:23:32 +0000 Subject: [PATCH] wsgi: Set multithread flag correctly Required making WSGIContainer.environ() an instance method. This is technically a backwards-incompatible change to a documented method but it was never really meant to be documented and seems unlikely to be used. --- tornado/wsgi.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tornado/wsgi.py b/tornado/wsgi.py index 3b2ceb62..32641be3 100644 --- a/tornado/wsgi.py +++ b/tornado/wsgi.py @@ -204,9 +204,12 @@ class WSGIContainer(object): request.connection.finish() self._log(status_code, request) - @staticmethod - def environ(request: httputil.HTTPServerRequest) -> Dict[Text, Any]: - """Converts a `tornado.httputil.HTTPServerRequest` to a WSGI environment.""" + def environ(self, request: httputil.HTTPServerRequest) -> Dict[Text, Any]: + """Converts a `tornado.httputil.HTTPServerRequest` to a WSGI environment. + + .. versionchanged:: 6.3 + No longer a static method. + """ hostport = request.host.split(":") if len(hostport) == 2: host = hostport[0] @@ -229,7 +232,7 @@ class WSGIContainer(object): "wsgi.url_scheme": request.protocol, "wsgi.input": BytesIO(escape.utf8(request.body)), "wsgi.errors": sys.stderr, - "wsgi.multithread": False, + "wsgi.multithread": self.executor is not dummy_executor, "wsgi.multiprocess": True, "wsgi.run_once": False, } -- GitLab