chiark / gitweb /
documentation/python: attempt to reproduce a Py3.6-specific issue.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 25 Nov 2019 16:59:25 +0000 (17:59 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 25 Nov 2019 16:59:25 +0000 (17:59 +0100)
documentation/test_python/inspect_annotations/inspect_annotations.html
documentation/test_python/inspect_annotations/inspect_annotations.py

index 70c0960a3e8c4c9bb9b0390fac30f92c81cdfdf7..50603d27da3f986a5593f56097b86f099c0727f4 100644 (file)
@@ -39,6 +39,8 @@
         <section id="classes">
           <h2><a href="#classes">Classes</a></h2>
           <dl class="m-doc">
+            <dt>class <a href="inspect_annotations.AContainer.html" class="m-doc">AContainer</a></dt>
+            <dd>A generic class. No parent class info extracted yet.</dd>
             <dt>class <a href="inspect_annotations.Foo.html" class="m-doc">Foo</a></dt>
             <dd>A class with properties</dd>
             <dt>class <a href="inspect_annotations.FooSlots.html" class="m-doc">FooSlots</a></dt>
index e4b6597324eabf100070feba6d53ec60c8c5e09f..7ef97fc948c09597ed9b7ad72c5728ca443b9819 100644 (file)
@@ -2,7 +2,7 @@
 
 import sys
 
-from typing import List, Tuple, Dict, Any, Union, Optional, Callable, TypeVar
+from typing import List, Tuple, Dict, Any, Union, Optional, Callable, TypeVar, Generic
 
 class Foo:
     """A class with properties"""
@@ -19,6 +19,12 @@ class FooSlots:
 
     annotated: List[str]
 
+_T = TypeVar('Tp')
+
+# Triggers a corner case with _gorg on Py3.6
+class AContainer(Generic[_T]):
+    """A generic class. No parent class info extracted yet."""
+
 def annotation(param: List[int], another: bool, third: str = "hello") -> float:
     """An annotated function"""
     pass
@@ -55,8 +61,6 @@ def annotation_list_noparam(a: List):
 if sys.version_info < (3, 7):
     annotation_list_noparam.__annotations__['a'] = List[TypeVar('T')]
 
-_T = TypeVar('Tp')
-
 def annotation_generic(a: List[_T]) -> _T:
     """Annotation with a generic type"""