Repository navigation
Accept dict subclasses as warning module globals - #9062
Draft
youknowdot wants to merge 1 commit into
Draft
youknowdot wants to merge 1 commit into
youknowdot wants to merge 1 commit into
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
youknowone
reviewed
Oct 10, 2026
| if vm.is_none(&mg) { | ||
| None | ||
| } else if !mg.class().is(vm.ctx.types.dict_type) { | ||
| } else if mg.downcast_ref::<PyDict>().is_none() { |
Member
There was a problem hiding this comment.
this will be affected by frozendict. let's keep it later to 3.15
youknowdot
force-pushed
the
fix-warning-globals-dict-subclasses
branch
2 times, most recently
from
October 11, 2026 03:21
9f97fc3 to
68d40a5
Compare
youknowdot
force-pushed
the
fix-warning-globals-dict-subclasses
branch
from
October 11, 2026 04:07
68d40a5 to
2820874
Compare
youknowdot
force-pushed
the
fix-warning-globals-dict-subclasses
branch
from
October 11, 2026 04:14
2820874 to
f9e7dd2
Compare
Contributor
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [ ] test: cpython/Lib/test/test_mmap.py (TODO: 19) dependencies: dependent tests: (2 tests)
Legend:
|
Preserve overridable loader lookup while reading module names from stored dictionary data. Assisted-by: OpenAI Codex:model identifier unavailable
youknowdot
force-pushed
the
fix-warning-globals-dict-subclasses
branch
from
October 12, 2026 13:49
f9e7dd2 to
a9dcb1b
Compare
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.
Current revision
Targets
mainafter #8950, with one logical commit:f9e7dd2f13900012883b8f3a2c583fcaf60f84cf(parent06007c81fa99e813cbf4583dab326764ba0ef017). The consolidated commit has exactly the same source tree as the prior reviewed head; original author attribution and assistance trailers are retained. No files underLib/are changed.Normal hooks, whitespace checks, and independent tree/history review passed. The temporary
[skip ci]marker is removed and normal CI is enabled for this final head. No new local build or runtime test is claimed. Validation recorded below belongs to earlier revisions unless explicitly stated otherwise.Summary
Extract Python 3.14-compatible dict-subclass support for
warn_explicit(module_globals=...)from #8954.Accept actual dict subclasses, while retaining the current diagnostics for other objects. Read
__name__from stored dictionary data rather than invoking subclass__getitem__or__missing__. The loader helper still intentionally calls overridable.getfor__loader__and__spec__.The second change is a necessary correction to the mega implementation: widening the gate alone would expose the wrong lookup behavior. No frozendict dependency, 3.15 error wording, category changes, or warning-state redesign is included.
Reference sources: CPython 3.14.7 warning gate and source lookup, loader blessing helper.
Provenance and overlap
43065e79ddc46eafeca58cb39398ac007b5d25f7.02917b6d9ca73257d081ca9e2af4ecf88d185e7e, preserving merged Honor warning instance categories before validating category arguments #9034 category behavior.Validation
Independent source review and normal commit hooks passed.
Native baseline rejects the new dict-subclass regression; the candidate passes.
Exact CPython 3.14.7 and native RustPython pass the complete updated warnings snippet. The existing initial warning output is unchanged.
Twelve unchanged canonical cases pass:
CFilterTests.test_module_globalsand all elevenCWarnTests.test_gh86298_*loader cases.The appended regression covers loader access order and present/absent stored names with raising item/missing overrides, using an in-memory loader.
Four snippet pytest entries passed (warnings and warning-keywords, both interpreters).
VM and CAPI Clippy with
-D warningspassed.The full workspace suite was not run locally; no existing assertions or markers were weakened.