From 02cc6621dbca7e42f0277e3bdf4405923cf6adef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:13:29 +0200 Subject: [PATCH] Update CHANGES --- CHANGES | 2 ++ sphinx/writers/latex.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index e7099805500..de8970b8316 100644 --- a/CHANGES +++ b/CHANGES @@ -73,6 +73,8 @@ Features added Bugs fixed ---------- +* #11093: LaTeX: fix build warnings when one or more reST labels directly preceed an + :rst:dir:`py:module` or :rst:dir:`automodule` directive. Patch by Bénédikt Tran (picnixz) * #11079: LaTeX: figures with align attribute may disappear and strangely impact following lists * #11110: LaTeX: Figures go missing from latex pdf if their files have the same diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 684164a1f7d..efb84735398 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1504,14 +1504,14 @@ def add_target(id: str) -> None: if node.get('ismod', False): # Detect if the previous nodes are label targets. If so, remove # the refid thereof from node['ids'] to avoid duplicated ids. - def has_dup_label(sib: Element | None) -> bool: + def has_dup_label(sib: Node | None) -> bool: return isinstance(sib, nodes.target) and sib.get('refid') in node['ids'] - prev: Element | None = get_prev_node(node) + prev = get_prev_node(node) if has_dup_label(prev): ids = node['ids'][:] # copy to avoid side-effects while has_dup_label(prev): - ids.remove(prev['refid']) + ids.remove(prev['refid']) # type: ignore prev = get_prev_node(prev) else: ids = iter(node['ids']) # read-only iterator