Commit 554a0c4
authored
🐛 fix(intersphinx): exclude builtin type aliases from mapping (#650)
When `docs.python.org` is configured as an intersphinx mapping, `dict`
types get incorrectly resolved as `wsgiref.types.WSGIEnvironment`. This
happens because `WSGIEnvironment` is a type alias for `dict[str, Any]`,
and at runtime its `__module__.__qualname__` resolves to `builtins.dict`
— which the mapping then records as a remapping target.
The root cause is that bare inventory names like `dict`, `int`, `str`
have no module prefix, so `rpartition(".")` yields an empty module path
and skips resolution entirely. This meant `builtins.dict` never entered
the exclusion set, allowing type aliases that resolve to builtins to
incorrectly claim the mapping.
The fix adds `builtins.{name}` to the exclusion set for all bare
inventory names, ensuring type aliases pointing to builtins are filtered
out.
Fixes #6491 parent bcd118f commit 554a0c4
File tree
2 files changed
+12
-0
lines changed- src/sphinx_autodoc_typehints
- tests
2 files changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
88 | 99 | | |
89 | 100 | | |
90 | 101 | | |
| |||
0 commit comments