Skip to content

Commit 7eeaed9

Browse files
author
Ikor Jefocur
committedAug 30, 2024
1 parent ce0d179 commit 7eeaed9

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
 

‎CHANGES.rst

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ Bugs fixed
9696
file URL (user-defined base URL of an intersphinx project are left untouched
9797
even if they end with double forward slashes).
9898
Patch by Bénédikt Tran.
99+
* #12797: Fix
100+
`TypeError: Some type variables (...) are not listed in Generic[...]`
101+
when inheriting from both Generic and autodoc mocked class.
99102

100103
Testing
101104
-------

‎sphinx/ext/autodoc/mock.py

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class _MockObject:
2929
__name__ = ''
3030
__sphinx_mock__ = True
3131
__sphinx_decorator_args__: tuple[Any, ...] = ()
32+
__sphinx_empty_attrs__: ('__typing_subst__',)
3233

3334
def __new__(cls, *args: Any, **kwargs: Any) -> Any:
3435
if len(args) == 3 and isinstance(args[1], tuple):
@@ -59,6 +60,8 @@ def __getitem__(self, key: Any) -> _MockObject:
5960
return _make_subclass(str(key), self.__display_name__, self.__class__)()
6061

6162
def __getattr__(self, key: str) -> _MockObject:
63+
if key in self.__sphinx_empty_attrs__:
64+
return self.__getattribute__(key)
6265
return _make_subclass(key, self.__display_name__, self.__class__)()
6366

6467
def __call__(self, *args: Any, **kwargs: Any) -> Any:

0 commit comments

Comments
 (0)
Please sign in to comment.