Repository navigation
Resolve class attribute docs at macro time and drop rustpython-doc from vm - #8830
Conversation
…om vm - #[pyclass] and #[pystruct_sequence] emit a sorted PyClassDef::ATTR_DOCS table from the doc database; attribute and slot docs look up that table. - rustpython-vm no longer depends on rustpython-doc. - _operator.attrgetter, itemgetter, methodcaller and object get constructor Args with FromArgs::PARAMS, replacing the hardcoded class signature docs in class.rs. - methodcaller() with no arguments raises "methodcaller needs at least one argument, the method name". Assisted-by: Claude:claude-opus-5-5 Assisted-by: Grok:grok-4.7
Bare `default` on integer and bool fields already renders the zero value in the text signature, so `default = 0` and `default = false` are replaced with bare `default`. Assisted-by: Claude:claude-opus-5-5 Assisted-by: Grok:grok-4.7
Assisted-by: Claude:claude-opus-5-5
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: RustPython/RustPython/.coderabbit.yml Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (44)
💤 Files with no reviewable changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change adds generated class attribute-documentation tables and uses them for slot documentation lookup. It also updates argument parsing declarations across the standard library and VM, adds constructor argument wrappers, and returns a shared empty-string singleton for empty input. ChangesClass attribute documentation
Argument parsing updates
Empty string interning
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Sequence Diagram(s)sequenceDiagram
participant rustpython_doc
participant attr_docs_tokens
participant PyClassDef
participant SLOT_DOCS
rustpython_doc->>attr_docs_tokens: supplies documentation entries
attr_docs_tokens->>PyClassDef: emits ATTR_DOCS table
PyClassDef->>SLOT_DOCS: provides attribute docs for slot lookup
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No merge-blocking behavior change was found; the PR is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The documentation change appears confined to generated, immutable metadata, and the inspected file-locking arguments retain their prior defaults. No new privilege path was identified. The broad callable surface and incomplete coverage leave some uncertainty. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Follow-up to #8815.
Doc lookup moves out of
rustpython-vm#[pyclass]and#[pystruct_sequence]now emit a sortedPyClassDef::ATTR_DOCStable. The table is built from the doc database while the macro expands.SLOT_DOCSlook up only that small per-class table. No const context searches the full database any more.rustpython-vmno longer depends onrustpython-doc. You can check this withcargo tree -p rustpython-vm -e normal,no-proc-macro.class.rsforobjectand_operator.attrgetter/itemgetter/methodcallerare removed. Their constructorArgsnow declareFromArgs::PARAMS, so the class signature comes from the normal path. Parsing and error messages are unchanged, except for one fix:methodcaller()with no arguments now raisesmethodcaller needs at least one argument, the method name.Smaller cleanups
default = 0anddefault = falseare replaced with baredefault. A baredefaulton integer and bool fields already renders the zero value in the text signature.Context::new_str("")returns theempty_strsingleton, so adefault = ""field yields the interned empty string.__doc__and__text_signature__for every native callable are unchanged: the whats_left--docand--signatureJSON dumps are identical before and after.🤖 Generated with Claude Code
Summary by CodeRabbit
fcntl.lockfstart position must now be provided instead of defaulting to zero.