Skip to content

Sync selected Python 3.15 core library tests and repr type errors - #9321

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:upgrade/python315-core-sync-repr
Oct 23, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:upgrade/python315-core-sync-repr

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Synchronize ten selected library paths with CPython 3.15.0 at d220409a13b77de7a6c30abe16ea90db01528edc, using the canonical updater and preserving existing RustPython adapters and expected-failure markers.

The synchronized ExceptionGroup regression exposed an actual main-RustPython failure: a non-string __repr__ result still produced __repr__ returned non-string (type NoneType) instead of the new qualified diagnostic. Update the generic Rust repr slot wrapper to emit {receiver_type}.__repr__() must return a str, not {result_type}, using the existing fully qualified type-name helper. Valid string results, including subclasses, and exceptions raised by __repr__ retain their existing paths.

The initial published head f128630 exposed another canonical regression in all three OS CI jobs: test_mutating_decode_handler_unicode_escape returned consumed length 4 after an error handler replaced an original six-byte buffer. The follow-up Rust fix retains the original input length on successful Unicode/raw-Unicode escape decoding and uses the current cursor only at existing incomplete non-final exits. This matches CPython's wrapper initialization and incomplete handling without changing buffer mutation, restart validation, warnings or canonical tests.

The 13-file patch contains:

  • Lib/platform.py and its tests: canonical normalization, deprecation and Python 3.15 API-removal changes.
  • Codec callback unregister coverage, ExceptionGroup repr coverage, builtin-function attributes, JSON escape/version cases, and frozendict set/UserDict coverage.
  • The required generic repr diagnostic fix in crates/vm/src/types/slot.rs.
  • Consumed-length accounting fixes in the two common Rust escape decoders.

Upstream test assertions, cases and guards are preserved rather than rewritten to accommodate RustPython. The canonical deep-ExceptionGroup stack guards and removal of the deprecated Java platform test come from the pinned CPython source; no local skip, xfail or assertion weakening was introduced to make the selected tests pass.

Validation

Linux, pinned Rust toolchain 1.99.1, with the candidate built from main Rust code plus this patch, not the separate vectorcall candidate:

  • cargo build --locked --offline --bin rustpython: passed.
  • cargo clippy --locked --offline -p rustpython-common -p rustpython-vm --lib -- -D warnings: passed on the codec-fix source; earlier VM-only lint also passed on the repr source.
  • Check-only rustfmt: earlier repr slot and both changed common escape-decoder files passed.
  • Normal commit hooks, without bypass: the initial commit passed merge-conflict, ruff format, redundant-test-patches, rustfmt, cspell and ruff checks; Prettier had no applicable files. The Rust-only codec follow-up passed merge-conflict, rustfmt and cspell; Python/Prettier hooks had no applicable files. Neither commit hook run changed tested source.
  • Bounded existing-TestCase selection: 55 passes and one canonical CPython-only skip, across ten fresh processes on the codec-fix source. Exact method selection preserved normal imports, fixtures and decorators; it did not use discovery or module-level load_tests.
    • Platform: 1 pass, test__comparable_version canonically skipped.
    • Codec callbacks: 4 passes, including the exact mutation method that failed CI, with all twelve canonical cases and three sliced-memoryview inputs.
    • Unicode/raw-Unicode escape codecs: 11 passes, including ordinary, warning/error, incremental, StreamReader and partial-input regressions.
    • ExceptionGroup repr: 6 passes, including test_repr_raises and its raised-exception propagation branch.
    • UserDict: 2 passes.
    • Sets/frozendict: 18 passes.
    • JSON: 7 passes, with pure-Python and accelerated bad-escape/truncated-input cases and implementation identities checked separately.
    • Builtin function attributes: 1 pass.
    • Builtin repr/ascii: 3 passes.
    • Descriptor/str-subclass repr: 2 passes.

Before the Rust fix, the same synchronized Lib files produced 5 passes, one canonical skip and the real test_repr_raises assertion failure; the original remaining 28 selectors were not run after that failure. Those results were retained. After rebuilding with the repr fix, all original 35 selectors and nine additional existing repr regressions ran under a new source/binary binding (43 passes and one canonical skip). The subsequent published f128630 CI failure in the Unicode mutation method was retained, not hidden by this bounded result. After the codec fix, all those 44 selectors plus twelve existing codec selectors ran under a separate fresh binding (55 passes and one canonical skip). The earlier initial build was interrupted without a terminal receipt; the successful retry and later fixed-source build reused verified owned compilation cache, not an unrelated binary.

Runtime source/tool/binary bindings, module-origin checks, per-ID accounting and resource checks passed in every completed fixed-source gate. The follow-up commit 03e7da1 has all 3,715 tracked file/link contents and modes independently verified against the final tested source manifest. Validation receipts retain their original pre-commit HEAD/status bindings; this is committed-source equivalence, not a claimed post-commit rerun.

Not run: complete affected-module suites, full workspace tests, separate crates/capi tests, release-profile validation, all-feature/build matrices, local Windows/macOS/WASM or other non-Linux checks. Earlier CI on f128630 failed the codec mutation case on Linux, macOS and Windows; a fresh CI result for the follow-up commit is not yet verified and is not implied by these Linux checks. These bounded results do not establish full Python 3.15 compatibility or whole-repository validation.

Relationship to other work

Fresh main was still e5554e23abfbaee85508c32fc22e5074f88aebdd when checked on October 23.

Among these ten Lib paths, only Lib/test/test_platform.py overlaps #8954. This is not ten extractions from that PR. The generic repr fix is new; #8954, #9320 and other open slot-related work touch different slot.rs areas. #6215 touches separate test_set.py hunks. This is a source-overlap review, not a merge-conflict simulation; related work may need reconciliation when landing.

AI assistance

OpenAI Codex assisted source synchronization/review, the Rust diagnostic and codec-accounting fixes, validation, and this PR description. The model version identifier is unavailable. These are automated checks, not a claim of human testing. The commit includes Assisted-by: OpenAI Codex:model version unavailable.

Synchronize ten selected library paths from CPython 3.15.0 at
d220409a13b77de7a6c30abe16ea90db01528edc using the canonical updater,
retaining existing RustPython adapters and failure markers.

Match generic __repr__ invalid-result errors to the qualified type-name
format required by the canonical ExceptionGroup regression, preserving
string results and exceptions raised by the implementation.

Implementation, source review, and validation were AI-assisted. The model
version identifier is unavailable; automated checks are not human
verification. Bounded validation covers 43 passes and one canonical skip,
not the full repository suites.

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

coderabbitai Bot commented Oct 23, 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
📥 Commits

Reviewing files that changed from the base of the PR and between e5554e2 and 03e7da1.

⛔ Files ignored due to path filters: 10
  • Lib/platform.py is excluded by !Lib/**
  • Lib/test/test_codeccallbacks.py is excluded by !Lib/**
  • Lib/test/test_exception_group.py is excluded by !Lib/**
  • Lib/test/test_funcattrs.py is excluded by !Lib/**
  • Lib/test/test_json/__init__.py is excluded by !Lib/**
  • Lib/test/test_json/test_fail.py is excluded by !Lib/**
  • Lib/test/test_json/test_scanstring.py is excluded by !Lib/**
  • Lib/test/test_platform.py is excluded by !Lib/**
  • Lib/test/test_set.py is excluded by !Lib/**
  • Lib/test/test_userdict.py is excluded by !Lib/**
📒 Files selected for processing: 3
  • crates/common/src/encodings/raw_unicode_escape.rs
  • crates/common/src/encodings/unicode_escape.rs
  • crates/vm/src/types/slot.rs
+-------------------------------------------------------------+
| All programming is an exercise in caching. - Terje Mathisen |
+-------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ 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.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[ ] lib: cpython/Lib/platform.py
[x] test: cpython/Lib/test/test_platform.py

dependencies:

  • platform (native: _wmi, itertools, sys, vms_lib, winreg)
    • _ios_support (native: sys)
    • ctypes (native: _ctypes, ctypes._aix, ctypes._endian, ctypes.macholib.dyld, ctypes.macholib.dylib, ctypes.macholib.framework, importlib.machinery, itertools, nt, sys)
    • argparse, collections, functools, os, plistlib, re, socket, struct, subprocess, warnings

dependent tests: (33 tests)

  • platform: test__locale test__osx_support test_asyncio test_baseexception test_builtin test_calendar test_cmath test_ctypes test_fcntl test_math test_mimetypes test_os test_platform test_regrtest test_shutil test_socket test_ssl test_strptime test_sysconfig test_time test_tkinter test_winreg test_wsgiref
    • idlelib: test_idle
    • profiling.sampling.gecko_collector: test_profiling
    • profiling.sampling.heatmap_collector: test_profiling
    • pydoc: test_enum test_pydoc
      • pdb: test_pdb
      • xmlrpc.server: test_docxmlrpc test_xmlrpc
    • uuid: test_os
      • wave: test_wave

[ ] test: cpython/Lib/test/test_set.py (TODO: 2)

dependencies:

dependent tests: (no tests depend on set)

[x] test: cpython/Lib/test/test_funcattrs.py (TODO: 1)

dependencies:

dependent tests: (no tests depend on funcattrs)

[x] test: cpython/Lib/test/test_dict.py (TODO: 1)
[ ] test: cpython/Lib/test/test_dictcomps.py
[x] test: cpython/Lib/test/test_dictviews.py (TODO: 1)
[x] test: cpython/Lib/test/test_userdict.py
[x] test: cpython/Lib/test/mapping_tests.py

dependencies:

dependent tests: (no tests depend on dict)

[x] lib: cpython/Lib/codecs.py
[x] test: cpython/Lib/test/test_charmapcodec.py
[x] test: cpython/Lib/test/test_codeccallbacks.py (TODO: 3)
[x] test: cpython/Lib/test/test_codecencodings_cn.py
[x] test: cpython/Lib/test/test_codecencodings_hk.py
[x] test: cpython/Lib/test/test_codecencodings_iso2022.py
[x] test: cpython/Lib/test/test_codecencodings_jp.py
[x] test: cpython/Lib/test/test_codecencodings_kr.py
[x] test: cpython/Lib/test/test_codecencodings_tw.py
[x] test: cpython/Lib/test/test_codecmaps_cn.py
[x] test: cpython/Lib/test/test_codecmaps_hk.py
[x] test: cpython/Lib/test/test_codecmaps_jp.py
[x] test: cpython/Lib/test/test_codecmaps_kr.py
[x] test: cpython/Lib/test/test_codecmaps_tw.py
[x] test: cpython/Lib/test/test_codecs.py (TODO: 2)
[x] test: cpython/Lib/test/test_multibytecodec.py
[x] test: cpython/Lib/test/testcodec.py

dependencies:

  • codecs

dependent tests: (186 tests)

  • codecs: test_charmapcodec test_codeccallbacks test_codecs test_eof test_exceptions test_importlib test_inspect test_io test_json test_locale test_logging test_multibytecodec test_os test_pdb test_plistlib test_sax test_str test_sys
    • email.charset: test_email
    • email.utils: test_httpservers test_smtplib test_urllib2
      • http.server: test_robotparser test_urllib2_localnet test_xmlrpc
      • logging.handlers: test_concurrent_futures test_pkgutil
      • smtplib: test_smtpnet
      • urllib.request: test_http_cookiejar test_pathlib test_pydoc test_site test_ssl test_urllib test_urllib2net test_urllibnet
    • encodings: test_email
      • locale: test__locale test_builtin test_c_locale_coercion test_calendar test_cmd_line test_decimal test_float test_format test_re test_regrtest test_strftime test_strptime test_tkinter test_types test_utf8_mode
    • json: test_embed test_json test_profiling test_pyrepl test_subprocess test_sysconfig test_tomllib test_tools test_traceback test_zoneinfo
      • importlib.metadata: test_importlib
      • profiling: test_profiling
    • pickle: test_annotationlib test_argparse test_array test_ast test_asyncio test_bool test_bytes test_bz2 test_collections test_concurrent_futures test_configparser test_coroutines test_csv test_ctypes test_defaultdict test_deque test_descr test_dict test_dictviews test_email test_enum test_enumerate test_fractions test_functools test_generators test_genericalias test_genericpath test_http_cookies test_io test_ipaddress test_iter test_itertools test_list test_lzma test_memoryview test_minidom test_opcache test_operator test_ordered_dict test_os test_pickle test_picklebuffer test_pickletools test_platform test_positional_only_arg test_random test_range test_set test_shelve test_slice test_socket test_statistics test_string test_structseq test_super test_time test_trace test_tuple test_turtle test_type_aliases test_type_params test_typing test_unittest test_urlparse test_uuid test_xml_dom_minicompat test_xml_etree test_xpickle test_zipfile test_zlib test_zoneinfo
      • tracemalloc: test_tracemalloc
    • plistlib:
      • platform: test__osx_support test_asyncio test_baseexception test_cmath test_ctypes test_fcntl test_math test_mimetypes test_shutil test_tkinter test_winreg test_wsgiref
      • webbrowser: test_webbrowser
    • tokenize: test_linecache test_peg_generator test_tabnanny test_tokenize test_unparse
      • inspect: test_abc test_asyncgen test_buffer test_clinic test_code test_grammar test_monitoring test_ntpath test_patma test_posixpath test_pyrepl test_signal test_sqlite3 test_type_annotations test_yield_from test_zipimport test_zipimport_support
      • linecache: test_bdb
      • traceback: test_asyncio test_code_module test_concurrent_futures test_contextlib test_contextlib_async test_dictcomps test_importlib test_listcomps test_pyexpat test_setcomps test_threadedtempfile test_threading test_unittest test_with

[x] lib: cpython/Lib/json
[ ] test: cpython/Lib/test/test_json (TODO: 2)

dependencies:

  • json

dependent tests: (19 tests)

  • json: test_embed test_json test_logging test_plistlib test_profiling test_pydoc test_pyrepl test_subprocess test_sysconfig test_tomllib test_tools test_traceback test_zoneinfo
    • importlib.metadata: test_importlib
    • multiprocessing.resource_tracker: test_concurrent_futures
    • pdb: test_pdb
    • profiling: test_profiling
      • cProfile: test_cprofile test_pstats

[ ] test: cpython/Lib/test/test_exceptions.py (TODO: 2)
[ ] test: cpython/Lib/test/test_baseexception.py
[x] test: cpython/Lib/test/test_except_star.py
[x] test: cpython/Lib/test/test_exception_group.py
[x] test: cpython/Lib/test/test_exception_hierarchy.py
[x] test: cpython/Lib/test/test_exception_variations.py

dependencies:

dependent tests: (no tests depend on exception)

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

Keep the original input length as consumed after successful unicode-escape
and raw-unicode-escape decoding, including error-handler input replacement.
Only report the current cursor when a non-final decode stops on incomplete
input, matching CPython's codec wrappers and incomplete exits.

Fix the canonical Unicode escape mutation regression that failed CI on
Linux, macOS and Windows. Preserve all Lib tests and existing assertions.
Bounded Linux validation: 55 passes and one canonical skip, CLI build and
strict common/VM Clippy passed. Full repository suites were not run.

Implementation, source review, and validation were AI-assisted. The model
version identifier is unavailable; automated checks are not human
verification.

Assisted-by: OpenAI Codex:model version unavailable
@youknowone
youknowone marked this pull request as ready for review October 23, 2026 09:01
@youknowone
youknowone merged commit c70e9b8 into RustPython:main Oct 23, 2026
20 of 21 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T09:08:39.227278Z 03e7da1 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: 03e7da1dae

ℹ️ 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".

'_json')


class TestModule(unittest.TestCase):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include the JSON version check in load_tests

When test_json is run through the normal module loader, this package's load_tests discards the loader-provided suite in _ and builds a fresh suite containing only doctests, TestPyTest, TestCTest, and discovered child modules. Since package discovery suppresses rediscovery of the package while its load_tests is active, TestModule.test_deprecated__version__ is never executed by the normal -m test test_json run; add this class to suite or retain the supplied tests so the new regression check actually runs.

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