Repository navigation
Accept dict subclasses as warning module globals - #9062
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (3)
✨ Finishing Touches
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 |
| if vm.is_none(&mg) { | ||
| None | ||
| } else if !mg.class().is(vm.ctx.types.dict_type) { | ||
| } else if mg.downcast_ref::<PyDict>().is_none() { |
There was a problem hiding this comment.
this will be affected by frozendict. let's keep it later to 3.15
9f97fc3 to
68d40a5
Compare
68d40a5 to
2820874
Compare
2820874 to
f9e7dd2
Compare
📦 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
f9e7dd2 to
a9dcb1b
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.