docs: execute context.clear() in doctests for Sphinx 9 compatibility#2717
Open
bobo-xxx wants to merge 1 commit intoGallopsled:devfrom
Open
docs: execute context.clear() in doctests for Sphinx 9 compatibility#2717bobo-xxx wants to merge 1 commit intoGallopsled:devfrom
bobo-xxx wants to merge 1 commit intoGallopsled:devfrom
Conversation
In Sphinx 9, doctest blocks marked with :hide: are not executed. This causes context.clear() calls in hidden blocks to be skipped, leading to assembler tests using the wrong architecture (arm instead of i386). This change moves context.clear() out of hidden doctest blocks into visible doctest lines, ensuring they are executed properly in Sphinx 9+.
There was a problem hiding this comment.
Pull request overview
Updates the introductory documentation doctests to remain compatible with Sphinx 9’s behavior change where .. doctest:: blocks marked :hide: are no longer executed, which previously caused context.clear() to be skipped and subsequent assembler examples to run under the wrong architecture.
Changes:
- Removed two hidden
.. doctest:: :hide:blocks that containedcontext.clear(). - Placed
>>> context.clear()as regular visible doctest lines so they execute under Sphinx 9+ doctest runs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In Sphinx 9, doctest blocks marked with
:hide:are not executed. This causescontext.clear()calls in hidden blocks to be skipped, leading to assembler tests using the wrong architecture (arm instead of i386).Fix
This change moves
context.clear()out of hidden doctest blocks into visible doctest lines, ensuring they are executed properly in Sphinx 9+.Changes
docs/source/intro.rst: Replaced two hidden doctest blocks containingcontext.clear()with visible doctest lines.Testing
The issue manifests when running doctests with Sphinx 9+, where hidden blocks are not executed. This fix ensures the context clearing happens as part of the visible doctest flow.
Fixes #2711