Skip to content

Commit 038da98

Browse files
authored
Merge pull request #232 from pllim/sphinx10-compat
Sphinx10 compatibility patch
2 parents 972c9fb + b46c8d6 commit 038da98

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changes in sphinx-automodapi
66

77
- Minimum supported Python version is now 3.10. [#229]
88

9+
- Compatibility with Sphinx 10. [#232]
910

1011
0.21.0 (2025-12-01)
1112
-------------------

sphinx_automodapi/smart_resolver.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
from docutils.nodes import literal, reference
1717

18+
from .utils import SPHINX_LT_9
19+
20+
__all__ = []
21+
1822

1923
def process_docstring(app, what, name, obj, options, lines):
2024
if isinstance(obj, type):
@@ -106,9 +110,12 @@ def missing_reference_handler(app, env, node, contnode):
106110
if (reftarget not in mapping and
107111
prefix in inventory):
108112

109-
if 'py:class' in inventory[prefix] and \
110-
reftarget in inventory[prefix]['py:class']:
111-
newtarget = inventory[prefix]['py:class'][reftarget][2]
113+
if ('py:class' in inventory[prefix] and
114+
reftarget in inventory[prefix]['py:class']):
115+
if SPHINX_LT_9:
116+
newtarget = inventory[prefix]['py:class'][reftarget][2]
117+
else:
118+
newtarget = inventory[prefix]['py:class'][reftarget].uri
112119
if not refexplicit and '~' not in node.rawsource:
113120
contnode = literal(text=reftarget)
114121
newnode = reference('', '', internal=True)

0 commit comments

Comments
 (0)