diff --git a/sphinx/ext/ifconfig.py b/sphinx/ext/ifconfig.py index bffaa49ff7c..f0d11507776 100644 --- a/sphinx/ext/ifconfig.py +++ b/sphinx/ext/ifconfig.py @@ -51,7 +51,7 @@ def process_ifconfig_nodes(app: Sphinx, doctree: nodes.document, docname: str) - ns = {confval.name: confval.value for confval in app.config} ns.update(app.config.__dict__.copy()) ns['builder'] = app.builder.name - for node in doctree.findall(ifconfig): + for node in list(doctree.findall(ifconfig)): try: res = eval(node['expr'], ns) except Exception as err: diff --git a/tests/roots/test-ext-ifconfig/conf.py b/tests/roots/test-ext-ifconfig/conf.py index 565f6bcb30a..e82ec79f23f 100644 --- a/tests/roots/test-ext-ifconfig/conf.py +++ b/tests/roots/test-ext-ifconfig/conf.py @@ -7,3 +7,4 @@ def setup(app): app.add_config_value('confval1', False, None) app.add_config_value('confval2', False, None) + app.add_config_value('false_config', False, None) diff --git a/tests/roots/test-ext-ifconfig/index.rst b/tests/roots/test-ext-ifconfig/index.rst index ab08aabef96..f7fabcc78f8 100644 --- a/tests/roots/test-ext-ifconfig/index.rst +++ b/tests/roots/test-ext-ifconfig/index.rst @@ -9,3 +9,13 @@ ifconfig egg +Issue 10496 regression test +=========================== + +.. ifconfig:: false_config + + `Link 1 `__ + +.. ifconfig:: false_config + + `Link 2 `__