⚡ Sangsakala Proxy 🏠 Home
Skip to content

Preserve Unicode in shared qualified type names - #9700

Draft
youknowdot wants to merge 2 commits into
RustPython:mainfrom
youknowdot:fix/qualified-type-names-20261104
Draft

youknowdot wants to merge 2 commits into
RustPython:mainfrom
youknowdot:fix/qualified-type-names-20261104

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Preserve Python string contents throughout shared qualified type names and their consumers.

  • Return WTF-8 from the existing PyType::fully_qualified_name helper. Static types use their native slot name; heap types read stored module/qualname metadata without metaclass or string-subclass callbacks.
  • Keep lone surrogates, embedded NULs and empty names through all 53 helper invocations on 51 source lines, using the existing wtf8_concat! mechanism rather than duplicate formatters.
  • Carry that representation through numeric warnings, percent-format context, AST/type/iterator diagnostics and weakref/ZoneInfo type-name prefixes. Extend the existing warning helper to accept WTF-8 while preserving String callers.

This is 367 substantive changed lines across 23 production Rust files. No Python, Lib, test, marker or workflow files change.

Verification

  • Compared against pinned CPython 3.15 source d220409a13b77de7a6c30abe16ea90db01528edc, including Objects/typeobject.c, numeric, weakref and ZoneInfo consumers.
  • 335 bounded CPython exact-message/representation assertions passed, plus 17 recorded metadata/warning edge probes. Independent review also checked three exact warning messages, all consumer paths and all 50 warning-helper callers.
  • Focused offline locked cargo check and ordinary all-targets cargo clippy for host-env, VM and stdlib with threading passed. Clippy reports exactly the four existing, unchanged-main diagnostics in posix/elementtree; none added or suppressed.
  • Independent source review, formatting, diff checks and normal commit hooks passed.

Native RustPython execution, full workspace/C-API tests and platform runtime suites were not run. Hosted CI remains the runtime validation gate; this draft does not claim a complete runtime suite pass.

Composition and limits

Compatible formatting companions are prepared for the additional consumers in #9693, #9697 and #9698. Preserve #9693's extracted hash-error helper, #9688's traceback arguments and #9690's removal of the old unraisable block when composing those changes. Older infrastructure overlaps were checked separately; this does not promise conflict-free merging of every historical refactor.

ZoneInfo's separately cached file-object repr still uses its existing String storage, and the native stderr fallback is not a new lossless OS-encoding implementation. These paths are not claimed fixed. The Rust helper's return type changes, so out-of-tree Rust callers may need to use WTF-8-aware formatting too.

AI assistance: OpenAI Codex performed source analysis, implementation, reference probing and independent review. Model version is not exposed. This contribution follows the maintainer-directed Python 3.15 upgrade work.

Reuse WTF-8 concatenation through native type metadata, diagnostics, warning context and representation consumers.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

Assisted-by: OpenAI Codex:model version not exposed
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.

1 participant