Skip to content

Commit d04bf01

Browse files
committed
Replace deprecated load_module in docs conf
SourceFileLoader.load_module is deprecated since 3.10 and gone in 3.15, which the test matrix already covers. ty 0.0.75 started flagging it, and the type environment runs with --error-on-warning, so main went red.
1 parent 2a4a215 commit d04bf01

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

docs/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import re
55
from importlib.machinery import SourceFileLoader
66
from pathlib import Path
7+
from types import ModuleType
78
from typing import TYPE_CHECKING, Any
89

910
from sphinx.domains.python import PythonDomain
@@ -173,7 +174,10 @@ def resolve_xref( # ruff:ignore[too-many-arguments]
173174

174175
app.connect("autodoc-process-signature", process_signature, priority=400)
175176
app.add_domain(PatchedPythonDomain, override=True)
176-
tox_cfg = SourceFileLoader("tox_conf", str(here / "tox_conf.py")).load_module().ToxConfig
177+
tox_conf_loader = SourceFileLoader("tox_conf", str(here / "tox_conf.py"))
178+
tox_conf = ModuleType(tox_conf_loader.name)
179+
tox_conf_loader.exec_module(tox_conf)
180+
tox_cfg = tox_conf.ToxConfig
177181
app.add_directive(tox_cfg.name, tox_cfg)
178182

179183
def check_uri(self: ExternalLinksChecker, refnode: reference) -> None:

0 commit comments

Comments
 (0)