Skip to content

Preserve FunctionType qualified names when overriding names - #9032

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-functiontype-qualname-314
Oct 10, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-functiontype-qualname-314

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Preserve code.co_qualname when types.FunctionType receives an explicit name. The name argument should replace only __name__, as in CPython 3.14.

Extracted from #8954 without the Python 3.15 dependencies. Adds a small regression for renamed and empty names to the existing stdlib_types.py snippet.

Validation:

  • CPython 3.14.7 passes the snippet; the pre-fix RustPython baseline fails the new qualified-name assertion.
  • Normal pre-commit hooks and VM Clippy pass.
  • Patched native runtime and aggregate tests await CI; local runtime linking is blocked by available disk space.

AI-assisted implementation, tests, and review with OpenAI Codex. Kept as a draft for CI and maintainer review.

Extract the independent Python 3.14-compatible constructor fix from RustPython#8954. An explicit name replaces __name__ while __qualname__ remains the code qualified name. Add a focused regression to the existing types snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5e25a302-41ac-454f-a3b3-9524c7b3917e

📥 Commits

Reviewing files that changed from the base of the PR and between 3af5f8a and 82ffeae.


📒 Files selected for processing (2)
  • crates/vm/src/builtins/function.rs
  • extra_tests/snippets/stdlib_types.py

 ______________________________________
< Be a super developer. Go home early. >
 --------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 marked this pull request as ready for review October 10, 2026 10:41
@youknowone
youknowone merged commit 386cd86 into RustPython:main Oct 10, 2026
21 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T10:44:00.447977Z 82ffeae Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82ffeae906

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

original = outer()
for name in ("renamed", ""):
function = types.FunctionType(original.__code__, globals(), name)
assert function.__name__ == name

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the prohibited test assertion additions

This added regression changes test logic and introduces new assertions in an extra_tests/snippets test, but the repository rules prohibit modifying test assertions or logic and limit test-file edits to adding or removing expectedFailure markers. Remove the snippet changes from this patch so the runtime fix complies with the contribution policy.

AGENTS.md reference: AGENTS.md:L275-L279

Useful? React with 👍 / 👎.

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.

2 participants