Skip to content

Commit 3787a7c

Browse files
AA-Turnerpradyunsg
andauthored
Patch app.config in a more resilient manner (#783)
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
1 parent 6a3afab commit 3787a7c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/furo/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,13 @@ def _builder_inited(app: sphinx.application.Sphinx) -> None:
283283
update_known_styles_state(app)
284284

285285
def _update_default(key: str, *, new_default: Any) -> None:
286-
app.config.values[key] = (new_default, *app.config.values[key][1:])
286+
try:
287+
conf_py_settings = app.config._raw_config
288+
except AttributeError:
289+
pass # Sphinx's config has changed.
290+
else:
291+
if key not in conf_py_settings:
292+
app.config._raw_config.setdefault(key, new_default)
287293

288294
# Change the default permalinks icon
289295
_update_default("html_permalinks_icon", new_default="#")

0 commit comments

Comments
 (0)