From 1be12345e2f6331c4f527287ddc580b03f743a70 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 15 Sep 2024 00:34:43 +0200 Subject: [PATCH] documentation/python: fix annotation extracting for typing.Any on 3.11+. --- documentation/python.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/documentation/python.py b/documentation/python.py index 7c542322..432a3182 100755 --- a/documentation/python.py +++ b/documentation/python.py @@ -1278,8 +1278,9 @@ def extract_annotation(state: State, referrer_path: List[str], annotation) -> Tu elif sys.version_info < (3, 7) and hasattr(annotation, '__name__'): name = 'typing.' + annotation.__name__ args = annotation.__args__ - # Any doesn't have __name__ in 3.6 - elif sys.version_info < (3, 7) and annotation is typing.Any: + # Any doesn't have __name__ in 3.6, and doesn't have anything in 3.11+ + # Not sure what commit caused that, probably https://github.com/python/cpython/pull/31841 + elif (sys.version_info < (3, 7) or sys.version_info >= (3, 11)) and annotation is typing.Any: name = 'typing.Any' args = None # Whoops, something we don't know yet. Warn and return a string -- 2.30.2