Repository navigation
Move consistency check helpers into md_debug.h - #1513
Merged
asvetlov merged 1 commit intoSep 22, 2026
Merged
Conversation
asvetlov
marked this pull request as ready for review
September 22, 2026 07:55
Contributor
|
4 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? `hashtable.h` was 2735 lines covering three separate things: the table itself, the single-key operations, and the multi-item `extend()`, `update()` and `merge()` engine behind the constructors and the bulk methods. The last of those was a contiguous block nothing else in the file called into, whose only consumer is `_multidict.c`. It moves verbatim into `multidict/_multilib/bulk_update.h`, along with the `UpdateOp` enum: `_md_update()`, `_md_merge()`, the `_md_post_update_*` family, `md_post_update()`, `md_update_from_ht()`, `md_extend_self()`, `md_update_from_dict()`, `md_update_from_kwnames()`, `md_update_from_seq()` and the sequence-parsing helpers beside it. The new header includes `hashtable.h`, so `views.h`, `iter.h` and `capsule.h` keep reaching only the hash table. This continues the split started by #1510, #1513 and #1522. Two things worth flagging for the reviewer. `_list_getitem_ref()` and `_list_item_gone()` stay behind. `views.h` uses them too, and it includes `hashtable.h` but not the new header, so moving them would have left `views.h` compiling only by accident of the include order in `_multidict.c`. They now have no user left in `hashtable.h` itself, which deserves a proper home shared with the open-coded two-element unpacking in `views.h`; that is its own change, not this one. The order the compiler sees does change, since the block now expands after the rest of `hashtable.h` rather than in the middle of it. `tools/codegen_diff.py` reports no difference at all, so nothing fell in or out of line. ## Are there changes in behavior for the user? No. The move is verbatim, and the pure Python implementation has no header structure to mirror. ## Is it a substantial burden for the maintainers to support this? No, it shrinks `hashtable.h` by around 710 lines and keeps the bulk paths separate from the table and its single-key API. ## Related issue number N/A ## Checklist - [x] I think the code is well written - [ ] Unit tests for the changes exist: N/A, code move only; the moved functions are already covered through the constructors, `extend()`, `update()` and `merge()` - [x] Documentation reflects the changes - [ ] If you provide code modification, please add yourself to `CONTRIBUTORS.txt`: N/A - [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` <details> <summary>Agent run details (optional, for reviewers)</summary> Rebased onto master after #1529 and #1530 landed; #1530 reworked the same region, so `bulk_update.h` was rebuilt from master's text rather than carried over from the earlier push, and its includes now name `reflist.h` instead of the removed `deferred_decref.h`. Verbatim-move check: the moved text, with the retained `_list_getitem_ref` block spliced back at its original offset, reconstructs master's `hashtable.h` lines 1693-2416 exactly. Codegen (`tools/codegen_diff.py --ref upstream/master`): - CPython 3.13.2: 0 of 191 functions differ - CPython 3.14.7t: 0 of 196 functions differ Tests, `python -m pytest tests -q -k "not test_leak"`, each in its own venv: - 3.13.2 release build: 2326 passed, 107 skipped - 3.13.2 debug build (`MULTIDICT_DEBUG_BUILD=1`, asserts on): 2326 passed, 107 skipped - 3.14.7t debug build: 2315 passed, 118 skipped - Pure Python (`MULTIDICT_NO_EXTENSIONS=1`, `--no-c-extensions`): 1124 passed, 17 skipped Lint: `pre-commit run --all-files` passed; `make doc-spelling` passed. </details> Drafted with Claude Code (Opus 5); reviewed by @asvetlov.
4 of 6 tasks
asvetlov
added a commit
that referenced
this pull request
Sep 25, 2026
<!-- Thank you for your contribution! --> ## What do these changes do? Renames `multidict/_multilib/md_debug.h` to `debug.h`. The `_multilib` headers are private, so the `md_` prefix on the file name carries no information. The include guard, the four `#include` sites and the file table in `AGENTS.md` are updated to match; clang-format re-sorted the includes. No code change. ## Are there changes in behavior for the user? No. ## Is it a substantial burden for the maintainers to support this? No. ## Related issue number Follow-up to #1513. ## Checklist - [x] I think the code is well written - [ ] Unit tests for the changes exist N/A, pure file rename covered by the existing suite - [x] Documentation reflects the changes - [ ] If you provide code modification, please add yourself to `CONTRIBUTORS.txt` N/A - [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 (Claude Opus 5.5); reviewed by @asvetlov. <details> <summary>Agent run details (optional, for reviewers)</summary> Tests: `MULTIDICT_DEBUG_BUILD=1` C extension on 3.13, 2683 passed, 180 skipped; C extension on 3.10.17, 2696 passed, 167 skipped. Pure-Python leg not run, since only C headers changed. Lint: pre-commit on changed files passed; `make doc-spelling` passed. </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?
Moves the debug-only
ASSERT_CONSISTENTmacro and the_md_check_consistency()/_md_dump()helpers out ofhashtable.hinto a newmultidict/_multilib/md_debug.hheader. Every file that callsASSERT_CONSISTENT(hashtable.h,views.h,_multidict.c) now includes it directly. The function bodies are moved verbatim; the forward declarations inhashtable.hare no longer needed. The pure Python backend is unaffected.Are there changes in behavior for the user?
No.
Is it a substantial burden for the maintainers to support this?
No, it shrinks
hashtable.hand keeps debug helpers separate from the hash table logic.Related issue number
N/A
Checklist
CONTRIBUTORS.txt: N/ACHANGES/foldermake doc-spellingpasses and any new technical words are added todocs/spelling_wordlist.txtDrafted with Claude Code (Claude Opus 5); reviewed by @asvetlov.
Agent run details (optional, for reviewers)
Tests,
python -m pytest tests -q -k "not test_leak":MULTIDICT_DEBUG_BUILD=1, asserts on): 2149 passed, 19 skipped--no-c-extensions): 1070 passed, 15 skippedLint: pre-commit on changed files passed;
make doc-spellingpassed.