]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
fix type signature for `_RuleList` 3455/head
authorMaximilian Hils <git@maximilianhils.com>
Fri, 17 Jan 2025 16:37:50 +0000 (17:37 +0100)
committerGitHub <noreply@github.com>
Fri, 17 Jan 2025 16:37:50 +0000 (17:37 +0100)
`List` is invariant, `Sequence` is covariant

tornado/routing.py

index ee81f977073088a1cce39c9e89508f189a6a1b33..ef99c20b21687aee92d31b53a3a5b4eefc32f97a 100644 (file)
@@ -184,7 +184,7 @@ from tornado.escape import url_escape, url_unescape, utf8
 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 @@ class _DefaultMessageDelegate(httputil.HTTPMessageDelegate):
 
 # _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.