From 58f34b83bf01fc50dcee6ee391e0f79d5798653c Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 17 Jan 2025 17:37:50 +0100 Subject: [PATCH] fix type signature for `_RuleList` `List` is invariant, `Sequence` is covariant --- tornado/routing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tornado/routing.py b/tornado/routing.py index ee81f97707..ef99c20b21 100644 --- a/tornado/routing.py +++ b/tornado/routing.py @@ -184,7 +184,7 @@ def request_callable(request): from tornado.log import app_log from tornado.util import basestring_type, import_object, re_unescape, unicode_type -from typing import Any, Union, Optional, Awaitable, List, Dict, Pattern, Tuple, overload +from typing import Any, Union, Optional, Awaitable, List, Dict, Pattern, Tuple, overload, Sequence class Router(httputil.HTTPServerConnectionDelegate): @@ -286,7 +286,7 @@ def finish(self) -> None: # _RuleList can either contain pre-constructed Rules or a sequence of # arguments to be passed to the Rule constructor. -_RuleList = List[ +_RuleList = Sequence[ Union[ "Rule", List[Any], # Can't do detailed typechecking of lists.