Repository navigation
Document the --no-c-extensions flag for the pure-Python test run - #1523
Merged
Merged
Conversation
Setting MULTIDICT_NO_EXTENSIONS=1 picks the backend that gets imported, but it does not deselect the C-extension half of the test matrix; only --no-c-extensions does. The c_extension-marked tests import multidict._multidict directly, so the command as documented errored out when no extension had been built, and silently tested a stale .so when one was left in the tree.
asvetlov
force-pushed
the
document-no-c-extensions-flag
branch
from
September 22, 2026 22:22
7b8ea38 to
84170f5
Compare
Contributor
|
5 of 6 tasks
asvetlov
added a commit
that referenced
this pull request
Sep 23, 2026
<!-- Thank you for your contribution! --> ## What do these changes do? `md_clear()` holds the last three stores to a shared entry field that do not go through `_multilib/freethreading.h`. #1518 left them alone on purpose but recorded the reason only in its own PR footer, so this puts it at the site. Nothing else changes. Keeping the raw access wins on two counts. `Py_CLEAR()` is not a decref plus `reset_identity()`: it skips the store entirely when the field is already NULL, which the accessors cannot express. And the block is the `#else` arm of `#ifdef Py_GIL_DISABLED`, so it compiles only on the GIL build, where every accessor is plain field access and there is no ordering for one to carry; the free-threaded build reaches none of it, since `_md_retire()` owns that path. A `clear_identity()` would therefore exist solely for a single GIL-only call site, which fails the bar #1518 set for adding an accessor: it has to unify the two builds. The two alternatives were built and measured rather than argued about; the numbers are in the footer. ## Are there changes in behavior for the user? No. Both builds compile to byte-identical machine code. ## Is it a substantial burden for the maintainers to support this? No. It is four lines of comment. ## Related issue number None. Split out of #1518, which reported these sites. ## Checklist - [x] I think the code is well written - [x] Unit tests for the changes exist (N/A, comment only; the existing suite is the test) - [x] Documentation reflects the changes (N/A, internal C header) - [ ] If you provide code modification, please add yourself to `CONTRIBUTORS.txt` - [x] Add a new news fragment into the `CHANGES/` folder - [x] `make doc-spelling` passes and any new technical words are added to `docs/spelling_wordlist.txt` Drafted with Claude Opus 5; reviewed by @asvetlov. <details> <summary>Agent run details (optional, for reviewers)</summary> Codegen, `objdump -d --no-show-raw-insn` compared per function against `master` at a794a6e with addresses, RIP displacements and intra-function branch offsets normalised. The harness was checked two ways first: two builds of the same tree are identical, and a throwaway comment inserted at the same spot is also identical, so it does not simply fail to notice things. | Variant | GIL build | Free-threaded build | | --- | --- | --- | | This PR (comment only) | 0 of 239 functions differ | 0 of 253 differ | | `clear_identity()`/`clear_value()` accessors replicating `Py_CLEAR()` exactly, including the skipped store | 23 of 239 differ | n/a, unreachable there | | Load, `reset_identity()`/`reset_value()`, then `Py_XDECREF` | 40 of 239 differ | n/a | The accessor variant is worth a note: its inlined body is the same instruction sequence, but GCC rotates the clearing loop differently, so it cannot be shown to be a no-op even though it is one. That is the whole reason this PR does not take it. Tests, all on this commit: - GIL build, CPython 3.14.2, C extension: 2210 passed, 21 skipped. - Free-threaded build, 3.14.7t, C extension: 2199 passed, 32 skipped. - Pure Python, per the recipe #1523 just added: 1103 passed, 15 skipped, 1112 deselected. No sanitizer or ThreadSanitizer run is quoted. The machine code is unchanged, so there is nothing for them to say that CI's own legs do not. `make doc-spelling` passes. `pre-commit run` passes; clang-format leaves the comment as written. </details>
asvetlov
added a commit
that referenced
this pull request
Sep 23, 2026
<!-- Thank you for your contribution! --> ## What do these changes do? `AGENTS.md` described how to run the suite without mentioning that the property tests under `tests/test_hypothesis_*.py` are not part of it. `pytest.ini` sets `-m "not hypothesis"`, so a plain `make test` skips them and reports a pass, and `make install-dev` does not install hypothesis either, since the pin lives in its own `requirements/pytest-hypothesis.txt`. Someone following the file as written would believe they had run the whole suite. The Tests section now records the marker override, the separate requirements file and the reason it is separate, and the fact that one `-m hypothesis` run already covers both backends. Documentation only. ## Are there changes in behavior for the user? No. ## Is it a substantial burden for the maintainers to support this? No. ## Related issue number None. Follow-up to #1523, which fixed the pure-Python invocation in the same section. ## Checklist - [x] I think the code is well written - [ ] Unit tests for the changes exist — N/A, documentation-only change - [x] Documentation reflects the changes - [ ] If you provide code modification, please add yourself to `CONTRIBUTORS.txt` — N/A, no such file in this repo - [x] Add a new news fragment into the `CHANGES/` folder - [x] `make doc-spelling` passes and any new technical words are added to `docs/spelling_wordlist.txt` Drafted with Claude Code (Opus 5); reviewed by @asvetlov. <details> <summary>Agent run details (optional, for reviewers)</summary> Claims checked against the tree rather than assumed. `make install-dev` really does not bring hypothesis in; a fresh venv built from `requirements/dev.txt` has no `hypothesis` module: ``` $ pip install -r requirements/dev.txt && pip install -e . $ python -c "import hypothesis" ModuleNotFoundError: No module named 'hypothesis' ``` The documented commands, run verbatim on CPython 3.14.7t: ``` $ pip install -r requirements/pytest-hypothesis.txt $ pytest -q -m hypothesis 143 passed, 4 skipped, 2210 deselected in 76.68s ``` That a single run covers both backends was confirmed by collection, which yields `-c` and `-py` ids together: ``` $ pytest -m hypothesis --collect-only | grep -oE "\[(cs|ci)?-?(c|py)\]" | sort | uniq -c 5 [c] 27 [ci-c] 27 [ci-py] 27 [cs-c] 27 [cs-py] 5 [py] ``` The note on why the pin is kept out of `requirements/pytest.txt`, and the two CI jobs, are taken from the existing comments on the `hypothesis-gil` and `hypothesis-freethreading` jobs in `.github/workflows/ci-cd.yml`. ``` $ make doc-spelling build succeeded. ``` `pre-commit run` over the changed files passes. </details>
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.
What do these changes do?
The pure-Python test command in
AGENTS.mddid not actually run thepure-Python suite.
MULTIDICT_NO_EXTENSIONS=1selects the backend thatimport multidictresolves to, but it has no effect on test selection:the C-extension half of the matrix in
tests/conftest.pycarries ac_extensionmarker, and only--no-c-extensionsdeselects it. Thosetests import
multidict._multidictdirectly, so following thedocumented command either errored out with
ModuleNotFoundErrorwhenno extension had been built, or silently ran against a stale
.soleftin the tree by an earlier C-extension install.
The command now passes both, with a short paragraph on why each is
needed. Documentation only; no code or test changes.
Are there changes in behavior for the user?
No.
Is it a substantial burden for the maintainers to support this?
No.
Related issue number
None.
Checklist
CONTRIBUTORS.txt— N/A, no such file in this repoCHANGES/foldermake doc-spellingpasses and any new technical words are added todocs/spelling_wordlist.txtDrafted with Claude Code (Opus 5); reviewed by @asvetlov.
Agent run details (optional, for reviewers)
Both failure modes reproduced before the change, on CPython 3.14.7t.
Clean checkout, no
.sopresent, running the command exactly asAGENTS.mddocumented it:Same tree with a
.soleft over from a previous C-extension install:the
[c]params and the standalonec_extension-marked tests collectand run against the extension, which is the case that reports a
meaningless pass. 49 tests failed that way in the worktree this was
found in, because the
.sowas stale relative to the checked-outsource.
With the flag, on both trees:
Docs:
pre-commit runover the changed files passes.