]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
wsgi: Set multithread flag correctly 3231/head
authorBen Darnell <ben@bendarnell.com>
Wed, 15 Feb 2023 21:23:32 +0000 (21:23 +0000)
committerBen Darnell <ben@bendarnell.com>
Thu, 16 Feb 2023 20:37:56 +0000 (20:37 +0000)
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

index 3b2ceb62275e116ae06008edf93bf62bbe645dc5..32641be30ff7a814da06a2cf09c0af88976eb999 100644 (file)
@@ -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,
         }