-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Move typeid into vtable #6231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Move typeid into vtable #6231
Conversation
WalkthroughRefactors type identity from a per-instance Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Caller (e.g., downcast)
participant PyObj as PyObject
participant VTable as PyObjVTable
Note over Caller,PyObj: Old flow (prior to this change)
Caller->>PyObj: obj.typeid() reads instance field
PyObj-->>Caller: returns per-instance TypeId
Note over Caller,PyObj: New flow (after this change)
Caller->>PyObj: obj.typeid() reads from vtable
PyObj->>VTable: access vtable.typeid
VTable-->>PyObj: TypeId (T::PAYLOAD_TYPE_ID)
PyObj-->>Caller: returns vtable TypeId
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Cargo.toml(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-11T05:06:59.971Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to Lib/**/*.py : Minimize modifications to CPython standard library files; only make minimal changes to work around RustPython limitations
Applied to files:
Cargo.toml
📚 Learning: 2025-09-11T05:06:59.971Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to {vm,stdlib}/**/*.rs : Use RustPython macros (`pyclass`, `pymodule`, `pyfunction`, etc.) when implementing Python functionality in Rust
Applied to files:
Cargo.toml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, the failing CI must not be related, right?
|
No idea how they are related, but re-running CI doesn't fix it. |
Now that
TypeId::of()is const, we can move the typeid intoPyObjVTableSummary by CodeRabbit