diff --git a/src/reactpy/backend/tornado.py b/src/reactpy/backend/tornado.py index c2a034ab2..b79f5fa0e 100644 --- a/src/reactpy/backend/tornado.py +++ b/src/reactpy/backend/tornado.py @@ -196,7 +196,7 @@ async def recv() -> Any: ConnectionContext( self._component_constructor(), value=Connection( - scope=WSGIContainer.environ(self.request), + scope=_FAKE_WSGI_CONTAINER.environ(self.request), location=Location( pathname=f"/{path[len(self._url_prefix):]}", search=( @@ -222,3 +222,10 @@ async def on_message(self, message: str | bytes) -> None: def on_close(self) -> None: if not self._dispatch_future.done(): self._dispatch_future.cancel() + + +# The interface for WSGIContainer.environ changed in Tornado version 6.3 from +# a staticmethod to an instance method. Since we're not that concerned with +# the details of the WSGI app itself, we can just use a fake one. +# see: https://github.com/tornadoweb/tornado/pull/3231#issuecomment-1518957578 +_FAKE_WSGI_CONTAINER = WSGIContainer(lambda *a, **kw: iter([]))