Commit 2077f50
committed
Clean
autodoc now attempts to import with `typing.TYPE_CHECKING = True`
first, and then falls back to `typing.TYPE_CHECKING = False` if that
fails. Unfortunately, the first import can leave behind some
partially-imported modules in `sys.modules` such that the retry fails.
Attempt to work around this by detecting what modules were added to
`sys.modules` by the first attempt and removing them before retrying.
Signed-off-by: Matt Wozniski <[email protected]>sys.modules if TYPE_CHECKING=True import fails1 parent 2f6ea14 commit 2077f50
File tree
6 files changed
+23
-1
lines changed- sphinx/ext/autodoc
- tests/roots/test-ext-autodoc
- circular_import
6 files changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
0 commit comments