Skip to content

Move type c-api functions#8233

Merged
youknowone merged 1 commit into
RustPython:mainfrom
bschoenmaeckers:c-api-move-type
Jul 7, 2026
Merged

Move type c-api functions#8233
youknowone merged 1 commit into
RustPython:mainfrom
bschoenmaeckers:c-api-move-type

Conversation

@bschoenmaeckers

@bschoenmaeckers bschoenmaeckers commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Expanded Python C API support for type inspection, including type identity checks, subtype checks, and type flag access.
    • Added C API accessors for type metadata: __name__, __qualname__, __module__, and fully qualified names.
  • Refactor
    • Consolidated the type-related C API into a dedicated module for clearer organization.
  • Tests
    • Updated/trimmed type-related tests to match the new structure and supported imports.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: abc3b7dc-22ba-4d0e-844b-d360bb5aaa0b

📥 Commits

Reviewing files that changed from the base of the PR and between 108e477 and de52783.

📒 Files selected for processing (2)
  • crates/capi/src/object.rs
  • crates/capi/src/object/pytype.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/capi/src/object/pytype.rs
  • crates/capi/src/object.rs

📝 Walkthrough

Walkthrough

PyType-related C-API exports and the PyTypeObject alias are moved from crates/capi/src/object.rs into crates/capi/src/object/pytype.rs, along with the associated type-introspection tests.

Changes

PyType C-API Relocation

Layer / File(s) Summary
New pytype module with C-API functions and tests
crates/capi/src/object/pytype.rs
Introduces PyTypeObject, type-check macros, exported PyType introspection functions, and unit tests for type name and module name behavior.
Remove old PyType exports and tests
crates/capi/src/object.rs
Removes the prior PyTypeObject alias, PyType-related exports, and the type_name / type_get_module_name tests from object.rs.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • RustPython/RustPython#7871: Removes the same PyType_Check, PyType_CheckExact, and PyType_IsSubtype exports at the C-API level.
  • RustPython/RustPython#7925: Touches the same PyType_GetName, PyType_GetQualName, and PyType_GetFullyQualifiedName C-API surface.
  • RustPython/RustPython#8042: Modifies the same PyType_* C-API definitions in crates/capi/src/object.rs, including PyType_GetModuleName.

Suggested reviewers: ShaharNaveh, youknowone

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: relocating type C-API functions into a separate module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@youknowone youknowone merged commit 0e2c848 into RustPython:main Jul 7, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants