Skip to content

Commit

Permalink
Merge branch '4.0.x' into 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed May 12, 2021
2 parents 3df43a8 + bde1816 commit 1513d50
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -68,6 +68,8 @@ Features added
Bugs fixed
----------

* #9210: viewcode: crashed if non importable modules found on parallel build

Testing
--------

Expand Down
9 changes: 5 additions & 4 deletions sphinx/ext/viewcode.py
Expand Up @@ -150,10 +150,11 @@ def env_merge_info(app: Sphinx, env: BuildEnvironment, docnames: Iterable[str],
if modname not in env._viewcode_modules: # type: ignore
env._viewcode_modules[modname] = entry # type: ignore
else:
used = env._viewcode_modules[modname][2] # type: ignore
for fullname, docname in entry[2].items():
if fullname not in used:
used[fullname] = docname
if env._viewcode_modules[modname]: # type: ignore
used = env._viewcode_modules[modname][2] # type: ignore
for fullname, docname in entry[2].items():
if fullname not in used:
used[fullname] = docname


def env_purge_doc(app: Sphinx, env: BuildEnvironment, docname: str) -> None:
Expand Down
6 changes: 5 additions & 1 deletion tests/test_util_inspect.py
Expand Up @@ -214,7 +214,11 @@ def test_signature_annotations():

# optional union
sig = inspect.signature(f20)
assert stringify_signature(sig) == '() -> Optional[Union[int, str]]'
if sys.version_info < (3, 7):
assert stringify_signature(sig) in ('() -> Optional[Union[int, str]]',
'() -> Optional[Union[str, int]]')
else:
assert stringify_signature(sig) == '() -> Optional[Union[int, str]]'

# Any
sig = inspect.signature(f14)
Expand Down

0 comments on commit 1513d50

Please sign in to comment.