Skip to content

Commit 8accc34

Browse files
committed
Merge branch '5.2.x' into 5.x
# Conflicts: # CHANGES # sphinx/__init__.py
2 parents d5b2899 + a651e6b commit 8accc34

File tree

7 files changed

+24
-15
lines changed

7 files changed

+24
-15
lines changed

CHANGES

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ Bugs fixed
1919
Testing
2020
--------
2121

22-
Release 5.2.1 (released Sep 24, 2022)
22+
Release 5.2.2 (released Sep 27, 2022)
23+
=====================================
24+
25+
* #10872: Restore link targets for autodoc modules to the top of content.
26+
Patch by Dominic Davis-Foster.
27+
28+
Release 5.2.1 (released Sep 25, 2022)
2329
=====================================
2430

2531
Bugs fixed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ lint = [
8787
"flake8-bugbear",
8888
"flake8-simplify",
8989
"isort",
90-
"mypy>=0.971",
90+
"mypy>=0.981",
9191
"sphinx-lint",
9292
"docutils-stubs",
9393
"types-typed-ast",

sphinx/domains/javascript.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def run(self) -> List[Node]:
298298
content_node.document = self.state.document
299299
nested_parse_with_titles(self.state, self.content, content_node)
300300

301-
ret: List[Node] = [*content_node.children]
301+
ret: List[Node] = []
302302
if not noindex:
303303
domain = cast(JavaScriptDomain, self.env.get_domain('js'))
304304

@@ -315,6 +315,7 @@ def run(self) -> List[Node]:
315315
indextext = _('%s (module)') % mod_name
316316
inode = addnodes.index(entries=[('single', indextext, node_id, '', None)])
317317
ret.append(inode)
318+
ret.extend(content_node.children)
318319
return ret
319320

320321
def make_old_id(self, modname: str) -> str:

sphinx/domains/python.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ def run(self) -> List[Node]:
10241024
content_node.document = self.state.document
10251025
nested_parse_with_titles(self.state, self.content, content_node)
10261026

1027-
ret: List[Node] = [*content_node.children]
1027+
ret: List[Node] = []
10281028
if not noindex:
10291029
# note module to the domain
10301030
node_id = make_id(self.env, self.state.document, 'module', modname)
@@ -1045,6 +1045,7 @@ def run(self) -> List[Node]:
10451045
indextext = '%s; %s' % (pairindextypes['module'], modname)
10461046
inode = addnodes.index(entries=[('pair', indextext, node_id, '', None)])
10471047
ret.append(inode)
1048+
ret.extend(content_node.children)
10481049
return ret
10491050

10501051
def make_old_id(self, name: str) -> str:

sphinx/domains/std.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class GenericObject(ObjectDescription[str]):
4747
A generic x-ref directive registered with Sphinx.add_object_type().
4848
"""
4949
indextemplate: str = ''
50-
parse_node: Callable[["GenericObject", "BuildEnvironment", str, desc_signature], str] = None # NOQA
50+
parse_node: Callable[["BuildEnvironment", str, desc_signature], str] = None # NOQA
5151

5252
def handle_signature(self, sig: str, signode: desc_signature) -> str:
5353
if self.parse_node:

sphinx/util/parallel.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
logger = logging.getLogger(__name__)
2020

2121
if sys.platform != "win32":
22+
ForkContext = multiprocessing.context.ForkContext
2223
ForkProcess = multiprocessing.context.ForkProcess
2324
else:
2425
# For static typing, as ForkProcess doesn't exist on Windows
25-
ForkProcess = multiprocessing.process.BaseProcess
26+
ForkContext = ForkProcess = Any
2627

2728
# our parallel functionality only works for the forking Process
2829
parallel_available = multiprocessing and os.name == 'posix'
@@ -92,7 +93,7 @@ def add_task(
9293
self._result_funcs[tid] = result_func or (lambda arg, result: None)
9394
self._args[tid] = arg
9495
precv, psend = multiprocessing.Pipe(False)
95-
context = multiprocessing.get_context('fork')
96+
context: ForkContext = multiprocessing.get_context('fork')
9697
proc = context.Process(target=self._process, args=(psend, task_func, arg))
9798
self._procs[tid] = proc
9899
self._precvsWaiting[tid] = precv

sphinx/util/typing.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def _restify_py36(cls: Optional[Type], mode: str = 'fully-qualified-except-typin
267267
return reftext + '\\ [%s]' % param_str
268268
else:
269269
return reftext
270-
elif isinstance(cls, typing.GenericMeta):
270+
elif isinstance(cls, typing.GenericMeta): # type: ignore[attr-defined]
271271
if module == 'typing':
272272
reftext = ':py:class:`~typing.%s`' % qualname
273273
else:
@@ -505,16 +505,16 @@ def _stringify_py36(annotation: Any, mode: str = 'fully-qualified-except-typing'
505505
return '%s%s[%s]' % (modprefix, qualname, param_str)
506506
else:
507507
return modprefix + qualname
508-
elif isinstance(annotation, typing.GenericMeta):
508+
elif isinstance(annotation, typing.GenericMeta): # type: ignore[attr-defined]
509509
params = None
510-
if annotation.__args__ is None or len(annotation.__args__) <= 2: # type: ignore # NOQA
511-
params = annotation.__args__ # type: ignore
512-
elif annotation.__origin__ == Generator: # type: ignore
513-
params = annotation.__args__ # type: ignore
510+
if annotation.__args__ is None or len(annotation.__args__) <= 2: # NOQA
511+
params = annotation.__args__
512+
elif annotation.__origin__ == Generator:
513+
params = annotation.__args__
514514
else: # typing.Callable
515515
args = ', '.join(stringify(arg, mode) for arg
516-
in annotation.__args__[:-1]) # type: ignore
517-
result = stringify(annotation.__args__[-1]) # type: ignore
516+
in annotation.__args__[:-1])
517+
result = stringify(annotation.__args__[-1])
518518
return '%s%s[[%s], %s]' % (modprefix, qualname, args, result)
519519
if params is not None:
520520
param_str = ', '.join(stringify(p, mode) for p in params)

0 commit comments

Comments
 (0)