Commit Graph
4478 Commits
Author SHA1 Message Date
youknowdot 75a2417043 Align type layouts and generic descriptors with Python 3.15 (#9175)
Import canonical descriptor tests through update_lib, preserving existing guards. Support tuple member slots, distinguish base reassignment from class layout compatibility, and share object-owned generic descriptors.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-17 14:13:50 +00:00
youknowdot fc9f4a9541 Update importlib to CPython 3.15 with native bootstrap callback (#9169)
* Refresh canonical importlib and preserve native import callback

Cache the original builtin __import__ callback so CPython 3.15 importlib's
hierarchical locking uses the existing native parent-initialization path.
Refresh the complete canonical importlib and related test/helper families
from CPython d220409a13b77de7a6c30abe16ea90db01528edc through update_lib.

Preserve both nondecorator importlib guards in the updater. Add explicit
hash-pinned removal of reviewed obsolete canonical files, with full
preflight, dry-run, idempotence and refusal tests. Preserve empty fixtures.

Assisted-by: OpenAI Codex:model version unavailable

* Complete canonical inspect and types closure for importlib metadata

Refresh whole canonical inspect/types production and related test families
through update_lib after hosted CI exposed stale __cached__ consumers.
Add coroutine and async-generator state getters, with closed-state priority
for reentrant frame-local finalizers, and expose the existing frame-locals
proxy type with its CPython class documentation.

Preserve the optional _datetime and unittest import blocks through a narrow
migration adapter. Retain canonical assertions and existing guards; record
the missing LazyImportType expectation before adding a conditional expected
failure, and capability-skip only the two absent-_testcapi CLI fixtures.

Assisted-by: OpenAI Codex:model version unavailable

* Reject canonical removal junctions and read UTF-8 manifests

Reject junctions alongside symlinks in the existing path-component preflight and revalidation. Decode removal manifests explicitly as UTF-8. Add regressions for whole-batch refusal, revalidation, and Unicode dry-run/apply/idempotence.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-17 14:40:13 +09:00
youknowdot 59570923c3 Align hashlib and HMAC with Python 3.15 (#9170)
Warn on the deprecated shared string keyword and refresh the complete
hashing libraries, canonical suites, and shared helper from CPython
v3.15.0 (d220409a13b77de7a6c30abe16ea90db01528edc) with update_lib.

Keep the six-file family independent and add no RustPython test guards.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-17 11:38:33 +09:00
youknowdot fb76135ec8 Align SSL APIs and transport behavior with Python 3.15 (#9167)
Refresh ssl.py and test_ssl.py through update_lib from CPython d220409a13b77de7a6c30abe16ea90db01528edc without local test changes. Implement rustls cipher-suite, group and signature policy, negotiated-group reporting, EOF and session-policy behavior.

Keep OpenSSL and wasm API imports compatible, with genuine version-gated queries and honest unsupported capabilities. Repair OpenSSL callback ownership and traversal, callback exceptions, EOF and shutdown, PHA, session destruction, and system-error decoding exposed by canonical coverage. Preserve existing I/O locking; the inherited optional-backend full-duplex hang remains a separate driver prerequisite.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-17 11:34:23 +09:00
youknowdot 19d2fe3af7 Align bytes and bytearray operations with Python 3.15 (#9165)
Correct quote escaping, replacement count keyword binding, signed-minimum hex grouping, and clear storage/export handling. Migrate canonical bytes coverage through fail-closed preservation of the existing RustPython customizations, and retire only two freshly verified formatting guards.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-17 11:33:14 +09:00
youknowdotandCodex 8720306805 Preserve function metadata and annotation callback lifetimes (#9162)
* Fix deprecated PyO3 code input import in benchmarks

Use the canonical code module path introduced in PyO3 0.30 without suppressing deprecation warnings.

Assisted-by: OpenAI Codex:model version unavailable

* Align runtime metadata and annotation cache contracts with Python 3.15

Preserve function name identity, implicit wrapper metadata and slice generic aliases. Match annotation dictionary and reentrant publication contracts, releasing displaced Python owners outside locks in the required phases. Refresh the matching canonical annotation tests through update_lib.

Assisted-by: OpenAI Codex: gpt-6.1-sol

* Refresh canonical generic alias coverage for slice

Migrate the complete Python 3.15 test_genericalias file through update_lib. Preserve the full canonical type list and capability guards so normal test runs cover slice subscripting.

Assisted-by: OpenAI Codex: gpt-6.1-sol

---------

Co-authored-by: Codex <codex@openai.com>
2026-10-16 23:45:57 +09:00
youknowdot 64330b80b9 Implement Unicode 17 grapheme iteration and properties (#9145)
* Implement native Unicode 17 grapheme iteration

Add the CPython extended grapheme state machine, full-codepoint properties, and traced Segment/iterator types with positional index handling. Refresh canonical unicodedata tests through update_lib while retaining pending markers. Include a losslessly range-compressed exact-final property oracle and differential test.

Source-reviewed implementation; candidate runtime validation remains pending. Reference property generation completed against the pinned CPython Unicode extension.

Assisted-by: OpenAI Codex:model version unavailable

* Bind grapheme Segment methods to the Python object

Use the required Py<Segment> receiver for native descriptors; preserve payload ownership and representation behavior.

Assisted-by: OpenAI Codex:model version unavailable

* Use explicit object receivers for Segment descriptors

Keep the inherent impl on the local payload and receive &Py<Self>, as required for stdlib classes outside the VM crate.

Assisted-by: OpenAI Codex:model version unavailable

* Mark grapheme property lookups as must-use

Satisfy strict Clippy for the three pure property functions without changing their behavior.

Assisted-by: OpenAI Codex:model version unavailable

* Enable validated Unicode grapheme canonical tests

Remove seven stale expected-failure markers through update_lib metadata after native property parity, canonical methods, full Unicode 17 grapheme corpus, and reference-cycle GC validation.

Assisted-by: OpenAI Codex:model version unavailable

* Accept platform line endings in grapheme oracle header

Compare the complete provenance line without its line ending so the same exact Unicode 17 reference is accepted after Windows checkout conversion. Keep the complete code-point property sweep unchanged.

Assisted-by: OpenAI Codex:model version unavailable

* Keep grapheme property regression in test module

Move the existing complete Unicode 17 property regression into the existing cfg(test) module to satisfy strict Clippy. Preserve the fixture, assertions, code-point coverage, and platform-independent provenance line check unchanged.

Assisted-by: OpenAI Codex:model version unavailable

* Qualify grapheme iterator return type for generated bindings

Assisted-by: OpenAI Codex:model version unavailable

* Fix deprecated PyO3 code input import in benchmarks

Use the canonical code module path introduced in PyO3 0.30 without suppressing deprecation warnings.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-16 23:40:26 +09:00
youknowdot fd5b30eb5e Align socket and socketserver with Python 3.15 (#9156)
Import the canonical socket libraries and tests through update_lib, preserving the existing AF_ALG expected failures. Match setsockopt index/buffer conversion and error ordering, mask optlen with the final CPython deprecation warning, reject oversized Windows buffers before the host call, and preserve arbitrary-precision getaddrinfo ports and empty canonical names.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-16 10:14:55 +09:00
youknowdot 1f4e9ffaf6 Align OS argument conversion and syscall handling with Python 3.15 (#9146)
* Align OS argument conversion and syscall handling with Python 3.15

Import canonical os tests through update_lib, retaining existing guards. Preserve raw descriptor validation, errno, audit ordering, signal retries and unlocked sendfile buffers.

Validation: independent source review passed; matching release build and nine bounded canonical cases pending.

Assisted-by: OpenAI Codex:model version unavailable

* Import canonical root-user test support for OS package

Add hash-pinned selective assignment migration within test.support and import the three Python 3.15.0 privilege helpers plus their public exports. Preserve unrelated support helpers and existing test markers.

Validation: 177 host updater tests pass; byte-identical canonical helper provenance verified. Independent source review passed. Native import validation pending integration onto current main.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-16 10:06:13 +09:00
youknowdot 8e5709e797 Align native threading and libraries with Python 3.15 (#9148)
Preserve lock ownership and elapsed timeouts during interruptible waits; reject RLock constructor arguments and use replacement encoding for thread names. Generate associated libraries and tests from CPython d220409a13b77de7a6c30abe16ea90db01528edc using update_lib, retaining five existing markers and retiring one proven removed test owner.

AI-assisted source preparation and review. Runtime validation remains pending.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 22:46:26 +09:00
Luan Taraschi bf404e0b7c Keep a bytearray exported while it formats with % (#9147)
bytearray.__mod__ copied the format and ran the arguments' __repr__,
__str__, __bytes__ and __index__ without holding an export, so a callback
could clear or extend the format and formatting went on with the old
copy:

    fmt = bytearray(b"%a end")
    class S:
        def __repr__(self):
            fmt.clear()
            return "E"
    fmt % S()   # bytearray(b'E end'), fmt left empty

CPython holds a buffer on the format for the whole call, so the resize
fails with BufferError and the format is left as it was. Taking an export
for the duration of __mod__ does the same here, the way bytearray.join
already does for its separator.

This lets test_mod_concurrent_mutation in test_bytes run again.

Assisted-by: Claude Code:claude-opus-5-5
2026-10-15 22:06:16 +09:00
youknowdot 901431963b Sync ten Python format and utility modules with Python 3.15 (#9144)
* Update ten Python library modules to Python 3.15 final

Migrate dependency-ordered linecache, locale, _pydecimal, decimal, random, uuid, wave, _strptime, zipapp and poplib with their canonical tests and WAV fixtures using update_lib.

Assisted-by: OpenAI Codex:model version unavailable

* Align dependent datetime and warning tests with Python 3.15 final

Generate complete dependent tests and pure datetime through update_lib from CPython d220409a13b77de7a6c30abe16ea90db01528edc. Preserve the existing tracemalloc expected failure. Pass warning module metadata to WarningMessage, use sys context after stack exhaustion, and identify invalid category classes with the existing qualified-name helper.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 21:59:44 +09:00
Luan Taraschi 8de2cbe732 Fix object.__getstate__ deadlock and panic on __slotnames__ (#8981)
object_getstate_default kept the __slotnames__ list read-locked while it
looked up each slot attribute. A getter or __getattr__ that changed the
list (as in test_descr.test_issue24097) then waited forever for the write
lock. A non-str entry in a cached __slotnames__ hit an unwrap and
panicked.

Take a reference to each name and drop the lock before the lookup, raise
TypeError for a non-str name, let errors other than AttributeError
propagate, and check the list size after each item, as CPython does.

Assisted-by: Claude Code:claude-opus-5-5
2026-10-15 20:45:42 +09:00
youknowdot 365ff68354 Align base64 encodings and binascii keywords with Python 3.15 (#9139)
* Align base64 encodings with Python 3.15

Accept hexlify keyword arguments and migrate base64 and its tests directly from CPython v3.15.0 using update_lib.

Assisted-by: OpenAI Codex:model version unavailable

* Update Hypothesis fallback for multi-argument examples

Import the CPython 3.15 final fallback helper with scripts/update_lib migrate. Keep canonical base64 round-trip examples unchanged while passing their positional arguments as one subTest message.

Validation: six canonical base64 methods, fourteen fixed examples; bounded source-only runs with the existing same-native PR binary.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 20:43:52 +09:00
youknowdot 8f12a32256 Sync ten foundational Python libraries with Python 3.15 (#9140)
* Sync ten foundational Python libraries with CPython 3.15

Migrate _py_abc, stat, genericpath, ntpath, posixpath, functools, gettext, string, optparse, and mimetypes with related canonical tests using scripts/update_lib from CPython d220409a13b77de7a6c30abe16ea90db01528edc. Preserve the existing pure LRU hash-count expected failure.

Assisted-by: OpenAI Codex:model version unavailable

* Preserve positional-only annotation order for singledispatch

Emit positional-only annotations before regular positional annotations, matching declaration order and the canonical functools regression coverage.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 20:42:50 +09:00
youknowdot 0384ddcd70 Align mmap operations and capability reporting with Python 3.15 (#9141)
Separate raw descriptor inspection from owned tracking, update flush and naming behavior, and expose resize only on implemented backends. Migrate canonical mmap tests using update_lib while preserving existing RustPython guards.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 19:53:53 +09:00
youknowdot 16e333bded Align asyncio initialization and future state with Python 3.15 (#9136)
* Align asyncio initialization and future state with Python 3.15

Reject native Future and Task reinitialization, validate task contexts, and restore task registration after failed eager context entry. Generate matching asyncio and concurrent Future sources and tests with update_lib from CPython d220409a13b77de7a6c30abe16ea90db01528edc. Preserve the existing pending-task reinitialization regression.

Assisted-by: OpenAI Codex:model version unavailable

* Remove asyncio snippet duplicating canonical reinitialization coverage

Keep the exact-final Lib tests as the reinitialization coverage instead of adding a new snippet for the same contract. Native and library implementation bytes remain unchanged.

Assisted-by: OpenAI Codex:model version unavailable

* Validate both objects in asyncio awaited-by helpers

Match CPython by ignoring non-native Future/Task waiters in add and discard. Keep the existing native reentrant hashing fixture reachable using Future subclasses and use native instances for its membership checks.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 10:02:39 +00:00
youknowdot 498adff3a9 Align JSON array hooks and libraries with Python 3.15 (#9135)
Generate the JSON library and selected tests with update_lib from CPython d220409a13b77de7a6c30abe16ea90db01528edc, preserving native bootstrap workarounds and test markers. Exclude generated cache directories at the library copy boundary.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 07:32:30 +00:00
youknowdot 8a9d66cfb3 Align OrderedDict views and sync pprint with CPython 3.15 (#9134)
* Align OrderedDict view inheritance and repr with CPython

Use dict view base payloads and inherited descriptors while preserving ordered iteration. Snapshot actual view iterators before rendering element reprs.

Assisted-by: OpenAI Codex:model version unavailable

* Sync pprint and its tests from CPython 3.15.0

Import the related library update using scripts/update_lib migrate from d220409a13b77de7a6c30abe16ea90db01528edc, preserving exact final source bytes.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 07:18:22 +00:00
youknowdot 4d54126c1f Update Unicode name preparation and codecs to Python 3.15 (#9132)
Import stringprep and related codecs from CPython 3.15.0 using scripts/update_lib. Preserve the existing Windows codec test marker.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 15:06:01 +09:00
youknowdot 2ddba03c39 Support frozen ElementTree attribute mappings (#9124)
* Support frozen ElementTree attribute mappings

Preserve assigned mapping identity while copying constructor attributes, and use checked union ownership through Element operations.

Assisted-by: OpenAI Codex:gpt-6.1-sol

* Sync final ElementTree runtime and companion tests

Import ElementTree.py from CPython d220409a13b77de7a6c30abe16ea90db01528edc through update_lib migrate. Copy six complete canonical tests with update_lib copy-test, preserving all surrounding test markers. This aligns pure-Python and native frozendict diagnostic expectations and covers the runtime import companion changes.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 10:27:39 +09:00
youknowdot 13d0c83753 Align Struct construction and complex formats with Python 3.15 (#9123)
Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 10:26:51 +09:00
1ndahous3 0363ff4eb6 Support nonblocking pipes on Windows (#9110)
* Support nonblocking pipes on Windows

Assisted-by: Codex:gpt-6

* Remove redundant Windows pipe test coverage

Assisted-by: Codex:gpt-6
2026-10-15 10:24:04 +09:00
youknowdotandyouknowdot f9b07b786c Update gzip, tarfile, and shutil from CPython 3.15 (#9112)
* Preserve truncating FileIO mode and sync canonical IO compatibility

Keep truncation metadata in both host backends so writable update streams report wb+. Synchronize the complete final CPython _pyio module and two complete canonical mode test definitions through scripts/update_lib.

Assisted-by: OpenAI Codex: model identifier unavailable

* Update gzip, tarfile, and shutil from CPython 3.15

Regenerate six Lib files using scripts/update_lib from CPython d220409a13b77de7a6c30abe16ea90db01528edc. Preserve upstream tests without agent-added marks.

Assisted-by: OpenAI Codex:model version unavailable

* Sync canonical spooled tempfile mode expectation

Copy the complete TestSpooledTemporaryFile.test_properties definition from CPython 3.15.0 final d220409a using scripts/update_lib copy-test. Preserve all surrounding test content and existing markers.

Assisted-by: OpenAI Codex:model version unavailable

---------

Co-authored-by: youknowdot <336763669+youknowdot@users.noreply.github.com>
2026-10-15 10:03:58 +09:00
youknowdot 0f127b07e9 Add Python 3.15 math APIs using pymath (#9122)
* Add Python 3.15 math APIs using pymath

Pin pymath to merged dd1e9a4cf26d68caf3b549c09476f52e356e16a3
and expose isnormal, issubnormal, signbit, fmax and fmin through thin
wrappers. Share the existing integer functions through math.integer
and _math_integer, matching CPython module identity and metadata.

Migrate test_math.py and test_math_integer.py via scripts/update_lib
from CPython d220409a13b77de7a6c30abe16ea90db01528edc, preserving the
existing Windows remainder marker. Add bounded Python snippet coverage.

AI assistance: OpenAI Codex implemented and source-reviewed this change,
ran update_lib, and performed focused automated validation. No human
manual testing is claimed.

Assisted-by: OpenAI Codex:model version unavailable

* Track integer math tests in library updates

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 10:02:44 +09:00
1ndahous3 05cb67524a Cache SQLite statements and synchronize connection operations (#9109)
* Cache SQLite statements per connection

Assisted-by: Codex:gpt-6

* Keep SQLite connections alive across callbacks

Assisted-by: Codex:gpt-6

* Defer SQLite cleanup and preserve operation errors

Assisted-by: Codex:gpt-6

* Synchronize SQLite results and transaction transitions

Assisted-by: Codex:gpt-6

* Use the calling thread's VM for SQLite callbacks

Assisted-by: Codex:gpt-6
2026-10-15 09:56:14 +09:00
youknowdot 5d5e3faa79 Implement Python 3.15 type alias and variadic metadata (#9113)
* Implement Python 3.15 type alias and variadic metadata

Add TypeAliasType qualified names and writable module metadata, and TypeVarTuple raw bounds and variance. Preserve Unicode names and validate arguments before invoking truthiness callbacks.

AI assistance: OpenAI Codex implemented and source-reviewed this split, prepared regressions, and ran focused automated validation. No human manual testing is claimed.

Assisted-by: OpenAI Codex:model version unavailable

* Sync canonical typing repr tests with Python 3.15 final

Copy six complete test definitions from CPython d220409a13b77de7a6c30abe16ea90db01528edc using scripts/update_lib copy-test with source and destination SHA256 pins. Preserve all surrounding tests and markers; no manual assertion edits or skips.

AI assistance: OpenAI Codex diagnosed old expected representations, performed the official copies and independent provenance review, and ran the six exact tests with the existing candidate release binary. All six pass; full suites were not rerun locally.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-14 16:14:46 +00:00
Jeong, YunWonanddot 2a09ee02bd Align compiler and VM bytecode contracts with CPython 3.15 (#9105)
* Align compiler and VM with final CPython 3.15 bytecode

Reconstruct the compiler-only baseline from validated487ae47 on the current main and frozen mapping prerequisitec78d811. Preserve the full source delta while dropping obsolete prerequisite ancestry; detailed old-to-new provenance is retained in the recovery artifact.

Assisted-by: OpenAI Codex: model identifier unavailable

* Fix final script validation, exception cleanup and private cache contracts

Replay reviewed compiler CI repairs 2191a9d, 1f1fe04, a2dacaf on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure.

Assisted-by: OpenAI Codex: model identifier unavailable

* Align canonical compiler fixtures and generator frame state

Replay reviewed compiler CI repairs 476bb74 on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure.

Assisted-by: OpenAI Codex: model identifier unavailable

* Preserve code-name owners and final warning and constant-fold contracts

Replay reviewed compiler CI repairs 6482adf on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure.

Assisted-by: OpenAI Codex: model identifier unavailable

* Skip unavailable monitoring C API tests before tool registration

Replay reviewed compiler CI repairs 246c309 on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure.

Assisted-by: OpenAI Codex: model identifier unavailable

* Assert exact final constant-list iterable folding

Replay reviewed compiler CI repairs 7ecedcf on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure.

Assisted-by: OpenAI Codex: model identifier unavailable

* Align local monitoring events and exception lifecycle state with final 3.15

Replay reviewed compiler CI repairs ec206b1, 191fe58 on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure.

Assisted-by: OpenAI Codex: model identifier unavailable

* Align 3.15 code objects and codegen with CPython

- Store co_consts, co_names, co_localsplusnames, co_localspluskinds,
  co_linetable, co_exceptiontable and co_name as objects on PyCode;
  build co_code and the varnames/cellvars/freevars tuples lazily in
  _co_cached, with co_code deoptimized through deopt_code.
- Move the compiler constant cache (_PyCode_ConstantKey,
  const_cache_insert) to builtins/code/const_cache.rs.
- Write every code field with w_object in marshal and pass the read
  field objects to MarshalBag::make_code through CodeFields.
- Emit RETURN_GENERATOR/POP_TOP in enter_scope and place SETUP_CLEANUP
  after them; drop the generator part of insert_prefix_instructions.
- Add PyCode::first_traceable (_co_firsttraceable) for
  _PyFrame_IsIncomplete and sys.monitoring.
- Follow the CPython DISABLE branches in sys.monitoring, the
  check_matched signature in warnings, the 3.15 % format error
  messages for str and bytes, code_returns_only_none, and the FOR_ITER
  stack analysis.
- Compute IMPORT_NAME flags with in_exception_handler.
- Replace the linetable/exceptiontable byte tests in codegen with
  dis(show_positions=True) insta snapshots in _opcode.
- Remove the opcode metadata verification tooling, byte-exact
  scripts, private cache tests and redundant snippets.
- Restore test_code.py and test_monitoring.py to v3.15.0 plus
  RUSTPYTHON markers.

Assisted-by: Claude Code:claude-opus-5-5

* Remove generator snippet checks covered by Lib/test

Drop extra_tests/snippets/generator_iterator_prefix.py. Its loop,
delegation, async, f_back and never-awaited checks are covered by
test_generators, test_coroutines, test_asyncgen, test_yield_from and
test_monitoring. Move the remaining checks into existing files:
genexpr prefix tracing and monitoring into stdlib_sys.py, and the
caller frame seen from the eager iterator into stdlib_sys_getframe.py.

Assisted-by: Claude Code:claude-opus-5-5

* Emit the generator prefix for top-level await modules

Module code compiled with PyCF_ALLOW_TOP_LEVEL_AWAIT and marked
ste_coroutine now starts with RETURN_GENERATOR; POP_TOP. The prefix and
RESUME emission move into emit_scope_prefix, shared by enter_scope and
the module entry points, as in codegen_enter_scope. Fixes
test_builtin.test_compile_top_level_await.

Assisted-by: Claude Code:claude-opus-5-5

* Allow the c_long cast in _opcode.stack_effect

c_long is i32 on Windows, where clippy reports the cast to i32 as
unnecessary.

Assisted-by: Claude Code:claude-opus-5-5

* Update malachite crates to 0.14.0

pymath requires malachite-bigint ^0, so the example projects, which
have no lock file, resolve it to 0.14.0 while the workspace pinned
0.13.0, and fail to build.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: dot <dot@youknowone.org>
2026-10-14 22:38:42 +09:00
youknowdotandyouknowdot 016ed92f9e Update email from CPython 3.15 (#9114)
Regenerate sixteen Lib files with scripts/update_lib from CPython d220409a13b77de7a6c30abe16ea90db01528edc. Preserve inherited test markers without manual Lib edits.

Assisted-by: OpenAI Codex:model version unavailable

Co-authored-by: youknowdot <336763669+youknowdot@users.noreply.github.com>
2026-10-14 21:46:45 +09:00
youknowdot a85a6cd762 Sync stdlib utilities from CPython 3.15.0 final (#9111)
Regenerate nine utility modules and associated tests with scripts/update_lib
from CPython d220409a13b77de7a6c30abe16ea90db01528edc.
Preserve existing mimetypes fixes by excluding that module from this split.

OpenAI Codex assisted with source audit, update_lib execution, and focused
release validation: 64 tests passed, one existing WASI-only skip.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-14 21:45:57 +09:00
28393e932d Implement PEP 814 frozendict (#8951)
* Restore consolidated frozendict implementation on current main

Preserve reverse dictionary iterator fixes and the 3.15 frame imports. Keep library refreshes separate pending the runtime dependency sequencing decision.

Assisted-by: OpenAI Codex:model identifier unavailable

* Support scoped canonical test updates in update_lib

Index conditional test classes and methods without crossing namespaces, reject ambiguous targets, and preserve inherited override indentation. Add hash-pinned whole-test copying that verifies execution context and exact source bytes, with focused Python fixtures.

Assisted-by: OpenAI Codex:model identifier unavailable

* Align frozendict copy support and tests with CPython 3.15

Import exact-final copy.py with update_lib; defer Mapping ABC registration to the later library stage. Generate only proven marker corrections, retain observed debug recursion-limit expected failures, and copy the complete canonical builtin-doc discovery test using hash-pinned update_lib copy-test.

Assisted-by: OpenAI Codex:model identifier unavailable

* Preserve decorator rationale during canonical test copying

Reject differing decorator source blocks even when their ASTs match. Cover inline and multiline marker comments, guarded async methods, and CLI no-write behavior.

Assisted-by: OpenAI Codex:model identifier unavailable

* Finish frozendict with borrowed PyAnyDict views

Use the landed PyRef target model for a transparent dict/frozendict header
view, retaining objects explicitly with PyRef<PyAnyDict>. Keep targets
sealed and preserve mutable-only entry points. Borrow frame globals from
the object header rather than movable reference wrappers.

Unify exact-TypeError key diagnostics with final CPython semantics,
including callback failure propagation and no explicit cause. Keep the
Python regressions in builtin_dict and test reference layout/ownership
in Rust. Preserve existing canonical library updates.

Assisted-by: OpenAI Codex:model identifier unavailable

* Align frozendict with CPython and use CPython 3.15 tests

- Name the target type in unhashable key errors through
  PyDict::update_arg (dict_update_arg), replacing the separate
  PyFrozenDict::merge_into copy of the merge logic.
- Split the | operator into dict_or (_PyDict_Or) and frozendict_or.
- Return the argument from frozendict(frozendict) only when the called
  type is frozendict.
- Call through the vectorcall slot in PyCallable::invoke when there
  are no keyword arguments, instead of special-casing frozendict.
- Add ensure_builtins (_PyEval_EnsureBuiltins) for eval/exec, and
  insert __builtins__ for source strings regardless of globals type.
- Read __warningregistry__ and __name__ from stored globals entries and
  accept only None or str for the module name in setup_context.
- Remove the unused PyFrozenDict::from_object.
- Migrate test_dict.py, mapping_tests.py, test_copy.py and
  test_builtin.py to v3.15.0 with update_lib, and add
  test_import/data/syntax_warnings.py.
- Drop builtin_dict.py frozendict tests covered by those modules,
  keeping the descriptor and namespace integration tests.

Assisted-by: Claude Code:claude-opus-5-5

* Update crates/vm/src/builtins/dict.rs

---------

Co-authored-by: Jeong YunWon <jeong@youknowone.org>
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-10-14 16:42:56 +09:00
youknowdotandyouknowdot 85edb52b65 Update enum from CPython 3.15.0rc2 (#8942)
Sync enum and its regression tests from CPython v3.15.0rc2 (435c9e5a798c99653e3ab64ce29baed0e4f3dfee). Preserve the two existing RustPython expected-failure decorators. Keep this first migration slice limited to enum without changing the declared Python target or native runtime.

AI assistance: Codex/OpenAI reconstructed the upstream sync, reviewed the diff, and ran validation. The runtime did not expose the exact model version.

Assisted-by: Codex:model-version-unavailable

Co-authored-by: youknowdot <336763669+youknowdot@users.noreply.github.com>
2026-10-13 10:50:51 +09:00
youknowdot cae11f6965 Sync email, mock, logging, and console behavior with Python 3.15 (#9079)
* Sync library behavior with CPython 3.15.0

Import exact d220409a13b77de7a6c30abe16ea90db01528edc sources through scripts/update_lib migrate, preserving the existing logging test marker. Retain focused Python license and mock property regressions outside Lib. This later Python-stage change requires native binascii wrapcol support; listener DNS runtime validation remains out of scope.

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep the library update limited to upstream files

Remove the two PR-added extra_tests snippets as requested in review. Preserve the script-migrated CPython library files and their canonical tests unchanged.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-12 22:17:26 +09:00
youknowdot 5f3daa5386 Implement Python 3.15 base64 APIs (#9085)
* Implement Python 3.15 base64 encoding and decoding

Follow CPython 3.15.0 final d220409a13b77de7a6c30abe16ea90db01528edc for base64 options, alphabets, padding and canonical decoding. Keep reverse-table caches in traced module-native state and preserve module-bound callable semantics. Add bounded Python regressions without editing Lib.

Assisted-by: OpenAI Codex:model identifier unavailable

* Complete binascii codecs for canonical Python 3.15 tests

Migrate Lib/test/test_binascii.py unchanged from CPython 3.15.0 final using scripts/update_lib and replace the superseded custom base64 snippet. Implement the base32, Base85, Ascii85 and hex ignorechars APIs required by the canonical suite. Share the existing module-bound original-key alphabet cache across base32/base64/base85 and preserve argument and buffer cleanup semantics. Keep the existing base64 kernels and VM state integration unchanged.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-12 16:12:24 +09:00
youknowdotandJeong, YunWon 06007c81fa Begin the Python 3.15 target and essential-library migration (#8950)
* Target Python 3.15 using the final upstream reference

Update active version and comparison configuration to Python 3.15.0. Preserve the alpha implementation status, actual bytecode format, and existing libraries pending separate migration. Align generated library-upgrade workflow pins without changing permissions or actions.

Assisted-by: OpenAI Codex:model identifier unavailable

* Adapt essential snippet contracts to Python 3.15 final

Preserve existing coverage while following verified final behavior for script metadata, builtin signatures and loading, AST fixture construction, memoryview diagnostics, mmap search bounds, and struct format errors. The unchanged final comparator exposes the earlier expectations; focused native baseline failures establish the required implementation changes.

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep final-reference regression paths and remove expired sysconfig argument

Preserve reverse multiplication syntax and native exact overflow diagnostics. Accept the two source-proven CPython 3.15 specialization messages only in affected reverse str/bytes/tuple cases. Use an actually out-of-range Windows datetime errno fixture. Remove the sysconfig check_home argument at its existing canonical 3.15 removal test boundary.

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep README wording unchanged in Python 3.15 transition

Assisted-by: OpenAI Codex:model identifier unavailable

* Match Python 3.15 repetition specialization and keep universal tests

Use exact sequence-type guards and preserve generic fallback diagnostics. Validate both cold and warmed expressions without implementation-specific assertions. Reject stale CPython source checkouts and cross-version library caches.

Assisted-by: OpenAI Codex:model identifier unavailable

* Limit in-place specialization additions to exact sequence repetition

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep subclass regression scoped to repetition dispatch

Assisted-by: OpenAI Codex:model identifier unavailable

* Provision final CPython 3.15 with pinned uv builds

Assisted-by: OpenAI Codex:model identifier unavailable

* Enforce Python 3.15 AST constructor requirements

Reject retired missing-field and arbitrary-keyword forms while preserving defaults and explicit placeholders. Sync only matching final CPython constructor test hunks.

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep seeded Python ahead of its Windows DLL directory

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep opcode metadata tied to the implemented bytecode format

The interpreter target and reference tests use Python 3.15.0, but the current Rust opcode enum retains the 3.14 bytecode format. Generate metadata from its matching source rather than importing unsupported instruction families.

Assisted-by: OpenAI Codex:model identifier unavailable

* Align CSV, logarithm and decimal formatting with Python 3.15

Propagate dialect lookup errors except AttributeError, retry integer logarithms after float overflow, and update the decimal conversion diagnostic. Exercise the final reference contracts without implementation-specific branches.

Assisted-by: OpenAI Codex:model identifier unavailable

* Bind the logarithm index result before borrowing its integer

Assisted-by: OpenAI Codex:model identifier unavailable

* Align required canonical test expectations with Python 3.15

Take only demonstrated contract changes from CPython v3.15.0, d220409a13b77de7a6c30abe16ea90db01528edc: removed module __cached__, Struct format exception classes, and decimal-format diagnostic. Preserve unrelated tests and expectations.

Assisted-by: OpenAI Codex:model identifier unavailable

* Track pending frozendict pickle support during the 3.15 transition

Keep the two existing frozendict pickle tests running as expected failures until #8951 supplies the builtin. Unexpected success will signal removal of these temporary markers.

Assisted-by: OpenAI Codex:model identifier unavailable

* Support final Python 3.15 Windows negative timestamps

Use FILETIME for pre-epoch conversions and preserve precise Windows timestamp errors.

Assisted-by: OpenAI Codex:model identifier unavailable

* Derive historical Windows timezone offsets from wall time

FILETIME reports historical DST as unknown, so calculate the actual offset rather than selecting standard-time bias.

Assisted-by: OpenAI Codex:model identifier unavailable

* Identify decimal formatting arguments in Python 3.15 errors

Track consumed positional arguments, including star width and precision, and preserve mapping key representations in decimal conversion diagnostics.

Assisted-by: OpenAI Codex:model identifier unavailable

* Reuse mapping format keys for lookup and error context

Assisted-by: OpenAI Codex:model identifier unavailable

* Borrow mapping diagnostic keys as Python objects

Assisted-by: OpenAI Codex:model identifier unavailable

* Avoid empty components in the reference Python library path

Assisted-by: OpenAI Codex:model identifier unavailable

* Isolate RustPython bytecode caches during the 3.15 transition

Assisted-by: OpenAI Codex:model identifier unavailable

* Sync final Windows timestamp test expectations

Import only the final CPython platform-limit guards and mktime roundtrip expectation required by the existing Windows CI suite.

Assisted-by: OpenAI Codex:model identifier unavailable

* Restore official Python setup for 3.15 final

Use the existing pinned setup-python action now that its official catalog supplies CPython 3.15.0. Remove the temporary standalone provisioning action and its sparse-checkout entry while retaining interpreter outputs and requested versions.

Assisted-by: OpenAI Codex:model identifier unavailable

* Align merged runtime contracts with Python 3.15 final

Restrict mappingproxy ordering, use final codec registry normalization, and prefer index conversion before float conversion for sleep. Retain universal Python assertions and import the matching final codec/time canonical test hunks plus the non-ASCII codec-name deprecation warning.

Upstream source: CPython d220409a13b77de7a6c30abe16ea90db01528edc. The existing codec normalization implementation and bytecode contract remain unchanged.

Assisted-by: OpenAI Codex:model identifier unavailable

* Limit Windows launcher version check to its interpreter

Exclude only the CPython py.exe version-identity case from RustPython CI. The installed launcher reports its own final version, while RustPython correctly remains alpha. Preserve the other 45 launcher cases and all RustPython version assertions without modifying Lib.

Assisted-by: OpenAI Codex:model identifier unavailable

---------

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-10-11 12:57:49 +09:00
youknowdotandJeong, YunWon 4dc50cc472 Validate mmap assignments against current storage (#9071)
* Preserve ParamSpec bounds as in Python 3.14.8

Extract the backported bound-validation removal and align the CPython reference pin to 3.14.8 so both snippet interpreters exercise the same contract.

Assisted-by: OpenAI Codex:model identifier unavailable

* Align TextIOWrapper chunk-size deletion with Python 3.14.8

The 3.14.8 reference pin exposes the Argument Clinic deletion guard moved before initialization and attachment checks by CPython 90a1f02b7da0c356d10a23f1faee7dc063f887ed. Preserve assignment checks and align the exact deletion error, including subclass type names.

Assisted-by: OpenAI Codex:model identifier unavailable

* Validate mmap assignments against current storage

Use the existing mapping guard for bounds and writes after argument conversion, including empty assignments. Match the Python 3.14.8 ordering while preserving export guards and ownership APIs.

Assisted-by: OpenAI Codex:model identifier unavailable

* Align mmap boundary regression with Python 3.14.8

Include the matching upstream GH-158027 test-data correction: use an integer RHS so the unchanged IndexError assertion checks index bounds after conversion. Preserve the runtime assignment and storage guards.

Assisted-by: OpenAI Codex:model identifier unavailable

---------

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-10-11 12:35:15 +09:00
youknowdot 1889ee627f Track live entries in reverse dictionary iterators (#9046)
* Track live entries in reverse dictionary iterators

Extract the Python 3.14-compatible remaining-count and same-size storage handling from #8954. Preserve the older deferred exhaustion and extra-yield contract, using explicit wrapping arithmetic rather than the Python 3.15 extra-yield error and cursor clamp. Cover deleted-slot hints and mutation after the last yield in the existing Python snippet.

Assisted-by: OpenAI Codex:model identifier unavailable

* Enable the repaired reverse-dict restoration regression

The patched native interpreter unexpectedly passes the existing reverse-dict clear/restore test. Remove only its obsolete expected-failure decorator, preserving the canonical assertions and all other markers.

Assisted-by: OpenAI Codex:model identifier unavailable

* Preserve reverse iterator invalidation on atomic relocation

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 12:44:03 +00:00
youknowdot fd062caaf4 Use current locale for byte regular-expression matching (#9042)
* Use current locale for byte regular-expression matching

Extract the Python 3.14-compatible LOCALE matching paths from #8954, keeping host callbacks outside the no_std engine and preserving the C-locale fallback. Existing canonical regex tests cover locale changes and compiled patterns. Keep expected-failure markers until patched native execution proves they are obsolete; omit duplicate snippet tests and Python 3.15 prefixmatch additions.

Assisted-by: OpenAI Codex:model identifier unavailable

* Enable the repaired locale caching regression

The exact patched native interpreter passes the existing locale flag and compiled-pattern tests and unexpectedly passes locale caching. Remove only the obsolete expected-failure decorator; preserve all canonical assertions and platform skips.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 10:54:20 +00:00
이광효andJeong YunWon a8e4bde885 Reject unsupported native keywords before argument binding (#8957)
* Reject unsupported native keywords before argument binding

Add explicit keyword dispatch metadata independently of inferred Rust
calling flags. Reject nonempty keywords before binding and conversion,
while preserving descriptor self checks and keyword-capable calls.

Annotate 31 builtins and list.append/list.clear, derive C-API policies
from ml_flags, and group dynamic registration metadata in MethodDefSpec.
Add regression coverage and remove the id doctest expected-failure marker.

Validation: workspace and C-API tests/clippy, VM without doc, keyword
regressions, and test_call/test_extcall/test_builtin/test_list passed.
The full snippet suite had 475 passes and 7 failures: six CPython-side
expectation mismatches and one missing optional SQLite module.

Assisted-by: Codex:GPT-6

* Infer native keyword dispatch from argument metadata

Replace no_keywords annotations with registration-time inference from
FromArgs::PARAMS, including nested parameter metadata. Forward arguments
with keyword-capable parameters to the binder, preserving min/max body
validation and descriptor self checks.

Add regressions for raw arguments, keyword argument structs, and list.sort.

Tested: C-API tests, workspace and C-API Clippy, VM without doc, both keyword
regression snippets, and test_call/test_extcall/test_builtin/test_list.
Workspace tests reported eight _opcode snapshot failures. The full snippet
suite reported 477 passes and seven failures: six CPython-side failures
and one RustPython failure due to the missing optional SQLite module.

Assisted-by: Codex:GPT-6

* Simplify native function registration metadata

Reuse SimpleItemMeta for pyfunction attributes and remove FunctionItemMeta.
Remove MethodDefSpec and restore the original new_method_def arguments
with an additional keyword_dispatch parameter, updating its callers.

Consolidate keyword dispatch regressions in syntax_function_args.py,
preserving their assertions and placing them before builtin shadowing.

Validation: workspace and C-API tests/clippy, VM without doc, the combined
snippet, and test_extcall/test_builtin/test_list/test_call passed.
The full snippet suite reported 477 passes and seven existing failures:
six CPython-side failures and one missing optional SQLite module.

Assisted-by: Codex:GPT-6

* Reject native keywords by calling convention flags

Remove `KeywordDispatch`, the `keyword_dispatch` field of `PyMethodDef`,
`PyMethodDef::with_keyword_dispatch`, `function::keyword_dispatch` and
the derive macros' `keyword_dispatch_tokens`. Native functions and method
descriptors reject nonempty keywords when `flags` lacks `KEYWORDS`, and
report the unqualified name when `flags` contains `VARARGS`.

`Context::new_method_def` takes `(name, f, flags, doc)` again. Add a
snippet for `int.__new__` called with a keyword argument.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2026-10-10 00:49:44 +09:00
Jeong, YunWonandJames David Clarke 1dcdec4dd5 Port the remaining runtime fixes from #7993 (#8995)
* Take re pos/endpos as signed integers

Negative values clamp to 0, and values beyond Py_ssize_t raise
OverflowError.

Assisted-by: Claude Code:claude-opus-5-5

* Port the remaining runtime fixes from #7993

- bytearray: keep the buffer exported while converting the needle of
  find/count/index/rfind/rindex/__contains__/split/rsplit and the hex
  separator, so resizing from there raises BufferError
- str(): report non-str encoding/errors as "str() argument 'X' must be
  str, not T", and check argument counts and name/position duplicates
  for keyword calls
- _json.scanstring: take end as a signed integer and raise ValueError
  when it is out of bounds
- lzma: reject filter specs with keys the filter does not take
- mmap: raise ValueError when growing a shared anonymous mapping on
  Linux/NetBSD
- _sqlite3: check that the backup progress argument is callable
- Remove the expectedFailure markers of the tests these fix

Assisted-by: Claude Code:claude-opus-5-5

* Reject arguments given by name and position in FuncArgs::bind_for

bind_for reports a keyword that fills a parameter already given by
position before other binding errors, using the parameter list of the
FromArgs type. getargs shares the message, str() drops its own check,
and blake2b/blake2s name themselves in binding errors.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: James David Clarke <james@jamesdavidclarke.com>
2026-10-08 08:11:26 +09:00
Jeongseop Lim 95686c08e4 Accept __index__ for the remaining int-bound arguments (#8999)
#8828 made bin(), chr() and several other arguments that were bound
as PyIntRef go through __index__, but these still downcast to int and
reject an object that only defines __index__: the start and end of the
str/bytes/bytearray find family, enumerate(start=),
itertools.combinations/combinations_with_replacement/batched,
_thread.stack_size, resource.getrlimit/setrlimit, pwd.getpwuid,
grp.getgrgid, fcntl.fcntl/lockf and mmap.move/madvise. CPython converts
all of them with _PyNumber_Index or _PyEval_SliceIndex.

Bind them as ArgIndex, as #8828 did for the others.

test_mmap.test_madvise and test_mmap_closed_by_int_scenarios now pass,
so drop their expectedFailure markers.

Assisted-by: Claude Code:claude-opus-5-5
2026-10-07 23:32:59 +09:00
a403341791 Take SyntaxError messages and ranges from the parser (#8983)
* Match CPython's SyntaxError range for unparenthesized `except` types

CPython's `invalid_except_stmt` rule raises the error only once the whole
clause has matched, and reports a range that starts at the first exception
type and ends at the `:` closing the clause, so it covers the `as NAME`
part as well:

    invalid_except_stmt:
        | 'except' a=expression ',' expressions 'as' NAME  ':' {
            RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types
            must be parenthesized when using 'as'") }

The parser reports the exception types alone, so look up that `:` in the
source and widen the range to match. Only `as NAME` may follow the
exception types, which is why the first `:` after them is the one closing
the clause.

    try:
        pass
    except A, B, C as e:
        pass

    CPython 3.14:  ('x.py', 3, 8, 'except A, B, C as e:\n', 3, 20)
    before:        ('x.py', 3, 8, 'except A, B, C as e:\n', 3, 15)

Fixes #8496

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Clarify that the `except` error range stops before the closing colon

`invalid_except_stmt_end` returns the exclusive end of the range, so the
column it yields is the one the `:` sits on even though the `:` is not part
of the range. The previous "ending at the `:`" wording read as if the colon
were included, which invites an off-by-one "fix".

Comments only; no behavior change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Fix the `except ... as` error column for non-ASCII names and line joins

`invalid_except_stmt_end` recovers the end of CPython's range by scanning the
source, which has to redo by hand what CPython gets from its tokenizer:

- The column was the byte distance from the line start, but `end_offset` is a
  character column. `except Ä, B as e:` reported 18 instead of 17. CPython
  converts explicitly, in `_PyPegen_byte_offset_to_character_offset`.
- The colon scan already spans explicit line joins, but the `as` check ran on
  the raw slice, so a `\` before `as` left the range unextended.
  `except A, B \` + `as exc:` reported (3, 12) instead of (4, 7).

Add regression cases to `syntax_invalid.py` covering both, plus the whitespace,
`except*` and line-join placements that already worked. All values are verified
against CPython 3.14.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Update the Ruff fork to 0.16.10

Point the rustpython-ruff_* dependencies at the 0.16.10-rustpython tag
of the RustPython Ruff fork and port to its AST changes:
`ExprCompare` stores all operands in `operands`, call arguments use
`ThinVec`, dict comprehension generators and f-string elements are boxed
slices, `FStringValue` iterates `FStringPartRef`, and `TokenKind::Name`
is now `TokenKind::Identifier`.

Assisted-by: Grok:grok-4.6
Assisted-by: Claude Code:claude-opus-5-5

* Drop the source scan for the `except ... as` error range

The parser now reports the unparenthesized exception types error with a
range ending at the `:` that closes the clause, so
`invalid_except_stmt_end` and the message match that widened the range
are removed.

Assisted-by: Claude Code:claude-opus-5-5

* Take parse error messages from the parser as they are

The Ruff fork now emits the final message texts, so `vm_new.rs` no
longer rewrites parse error messages by matching their text and no
longer lowercases the first character of every message.
`analyze_compile_error` keeps only the caret narrowing for starred
expressions and the line number in the unterminated string message.
The compiler matches the new lowercase texts for indented block and
mixed bytes literal errors.

The fork is referenced by revision until it is published.

Assisted-by: Claude Code:claude-opus-5-5

* Take starred and bytes literal error ranges from the parser

The Ruff fork now reports misplaced starred expressions at the `*` and
non-ASCII bytes literal errors over the whole literal. `vm_new.rs` drops
`narrow_caret` together with `SyntaxErrorInfo`, which only carried the
message after that, and the compiler drops `bytes_literal_span`.

Assisted-by: Claude Code:claude-opus-5-5

* Take indentation error kinds and positions from the parser

The Ruff fork now reports `TabError` and `TooDeepIndentation` as their
own lexer errors and places indentation and line continuation errors
itself. `vm_new.rs` picks TabError or IndentationError from the error
kind instead of scanning the source for mixed indentation, drops the
TabError message override, and sets the end offset of tokenizer errors
to 0 or -1 by kind. The compiler drops the line-end relocation of
unindent errors and the line continuation rewrite. `_tokenize` raises
TabError and depth errors for the token they replace, also for sources
containing tabs.

Remove expectedFailure from test_tokenize.test_max_indent and four
test_tabnanny tests.

Assisted-by: Claude Code:claude-opus-5-5

* Take unterminated string messages from the parser

The Ruff fork's unterminated string errors now include the detected
line and are reported at the start of the string. `vm_new.rs` drops its
message override for `UnclosedStringError`, and the shell continues a
line on an unterminated triple-quoted string by the error's
`triple_quoted` flag instead of reading the quotes from the source.

Assisted-by: Claude Code:claude-opus-5-5

* Take bracket errors and tokenizer error priority from the parser

Bump the ruff fork, which now reports unmatched, mismatched, unclosed
and too deeply nested brackets and decides whether a tokenizer error
replaces the parser's first error.

Remove the bracket, unterminated string and nesting depth source
scanners and `pre_parse_source_error`. A tokenizer error from the
parser now wins over source scanner diagnostics found after it. An
unclosed bracket is incomplete input only when the parser reports it
as such, and other tokenizer errors end where they start.

Remove the expected failure markers from test_unicode_identifiers
test_invalid and the `import ä £` doctest in test_syntax.

Assisted-by: Claude Code:claude-opus-5-5

* Take number literal, string prefix and non-printable errors from the parser

Bump the ruff fork, which now reports malformed number literals,
incompatible string prefixes and non-printable characters itself.

Remove the number literal, string prefix and non-printable character
source scanners and the override classes that ranked them. Leading zero
and string prefix errors keep their range instead of ending where they
start.

Assisted-by: Claude Code:claude-opus-5-5

* Take the missing indented block error from the parser

Bump the ruff fork, which now reports `ExpectedIndentedBlock` with the
clause and the line of its header keyword.

Remove the message rewrite that derived the clause and line from the
source. The VM chooses IndentationError or incomplete input by the
error variant instead of its message.

Assisted-by: Claude Code:claude-opus-5-5

* Take binding target errors from the parser

Bump the ruff fork, which now names the invalid expression in
assignment, augmented assignment, delete, `for`, `with`, import,
pattern and `except` target errors.

Remove the source scanners for those targets and the message rewrites
of `InvalidAssignmentTarget` and `InvalidNamedAssignmentTarget`.
Remove the expected failure markers from test_syntax doctests that now
pass.

Assisted-by: Claude Code:claude-opus-5-5

* Take parameter, argument, star, comma and dictionary errors from the parser

Bump the ruff fork to 36919b62fa. Remove the source scanners for type
parameters, parameter lists, star annotations, call arguments, def type
parameters, parenthesized groups, missing commas and dictionary items.
Set end_offset 0 for ExpectedColonAfterDictionaryKey. Remove 14
EXPECTED_FAILURE markers in test_syntax and test_unpack_ex.

Assisted-by: Claude Code:claude-opus-5-5

* Take expression errors from the parser

Bump the ruff fork to 4f922d2124. Remove the source scanners for
comprehensions, collection and condition assignments, expressions
between strings, named expression targets, missing `in` after for-loop
variables and statements in `if` expressions. Remove the now passing
expected failure markers in test_syntax and test_named_expressions.

Assisted-by: Claude Code:claude-opus-5-5

* Take statement errors from the parser

Bump the ruff fork to c7f6594ed6. Remove the source scanners for
standalone except, `import ... from`, `**_` mapping rests, `elif` after
`else` and mixed except handlers, and the post-parse scanners for call
arguments, match targets, yield after a comma and parenthesized star
imports.

Assisted-by: Claude Code:claude-opus-5-5

* Take string and f-string errors from the parser

Bump the ruff fork to 6b46d0dfc8. Remove the source scanners for
malformed `\N` escapes, f-string and t-string replacement fields, mixed
t-string literals and `print`/`exec` statements, and the override
plumbing they used. Drop the `f'{x'; '` case from the compiler test,
whose expected message differs from CPython 3.14.

Assisted-by: Claude Code:claude-opus-5-5

* Restore the bracket depth check and fix incomplete unclosed strings

Restore `pre_parse_source_error`, which rejects bracket nesting past 200
levels before parsing. The parser reports the same error but still
builds the full tree, which overflows the native stack when dropped.

Remove the VM's unclosed string scanner, which ignored the mode and
treated `'abc` in exec mode as incomplete input. The compiler's check
now skips escaped newlines.

Assisted-by: Claude Code:claude-opus-5-5

* Report multiple statements before later errors in single mode

In single mode, when the first statement is a simple statement, report
code after its line as multiple statements before any error found
later, at the newline token or the comment before it. This replaces the
multiple statements check on the parsed body and also applies to
`ast.parse(mode='single')`.

An unclosed string that follows an earlier syntax error is no longer
incomplete input. The bracket depth error range is now empty.

Assisted-by: Claude Code:claude-opus-5-5

* Update the Ruff fork for parser speed and starred annotations

Bump the ruff fork to 8b59b85344, which skips the tokenizer error pass
when parsing finds no errors, stops allocating for every identifier's
string prefix check, and reports `def f(*args: *b = ...)` as invalid
syntax.

Remove expected failure markers from test_code_module
test_indentation_error and test_sysexcepthook_indentation_error, and
from test_dictcomps test_illegal_assignment.

Assisted-by: Claude Code:claude-opus-5-5

* Use the published Ruff fork 0.16.10 crates

Switch the rustpython-ruff_* dependencies from the git revision to the
0.16.10 crates.io release, published from the same commit (8b59b85344).

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: zzarbttoo <qodbwls70@naver.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-10-07 12:54:27 +09:00
Seonghun AnandJeong YunWon 3d1c174d17 Match invalid format specifier error messages (#8477)
* Match invalid format specifier error details

Assisted-by: Codex:gpt-5.6-sol

* format: convert FormatSpecError in one helper

InvalidFormatSpecifier needs the spec and the object type. Drop
IntoPyException so that path cannot produce a generic message.

Assisted-by: Grok:4.6

---------

Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2026-10-05 16:39:46 +00:00
5b5c0c7df7 Give dict a CPython-style message for unhashable keys (#8610)
* Give dict a CPython-style message for unhashable keys

Dict operations (subscription, membership, get/pop/setdefault, ...) now
raise "cannot use 'X' as a dict key (unhashable type: 'X')", matching
CPython 3.14 and mirroring the existing PySetInner wrapping. The key is
only materialized on the error path, so hashable keys pay no extra cost.

Enables Lib/test/test_dict.py::DictTest::test_unhashable_key.

Assisted-by: Claude Opus 4.8 (Anthropic)

* dict: only rewrite hashing failures, not key-comparison errors

wrap_unhashable_error previously rewrote any TypeError from a dict
operation as an unhashable-key error, but those operations also compare
keys on a hash collision, so a TypeError from a colliding key's __eq__
was mislabeled. Disambiguate on the error path by re-hashing the key, so
the successful path still hashes exactly once (keeps the do-not-rehash /
atomic invariants) while comparison errors propagate unchanged.

Adds a colliding-key regression test.

Assisted-by: Claude Opus 4.8 (Anthropic)

* dict: hash unhashable keys once up front and cover every insertion path

Addresses the review feedback (thanks @luantaraschi):

- The message now reaches update(), the constructor and |= as well, not just
  __setitem__: merge_object_with_override and merge_from_seq2 now hash the key
  up front and thread it into contains_known_hash/insert_known_hash.
- Hash the key once instead of re-hashing on the error path. This threads the
  hash through the *_known_hash operations (add dict_inner get_known_hash), so
  a __hash__ that fails only on its first call is still reported instead of
  escaping unwrapped.
- Use the fully-qualified type name (matching CPython's %T).
- Only an exact TypeError is rewritten; a __hash__ raising a TypeError subclass
  now propagates unchanged.

pop() and setdefault() have no *_known_hash entry point on the inner map, so
they hash once up front for the message and then do their own single lookup.

Assisted-by: Claude Opus 4.8

* dict: thread the known hash through setdefault and pop as well

Follow-up on the review: setdefault() and pop() previously hashed the key a
second time (inside the inner map) after hash_or_unhashable already hashed it,
so a stateful __hash__ failing on the second call would skip the dict-specific
message. Add setdefault_known_hash / pop_known_hash to the inner map and thread
the precomputed hash, so every operation now hashes exactly once. Adds a
regression test asserting setdefault/pop call __hash__ only once.

Assisted-by: Claude Opus 4.8

* test: hash the key on a non-empty dict so CPython 3.14 exercises the pop path

`{}.pop(CountingHash())` on an empty dict does not hash the key under
CPython 3.14 (the lookup short-circuits), so `CountingHash.calls == 1` was 0
and the snippet failed its CPython parity run. Use a non-empty dict so the
lookup must hash the key exactly once, on both CPython and RustPython. Also
applied `ruff format` (two blank lines before top-level defs).

Assisted-by: Claude Opus 4.8 (Anthropic)

* dict: drop unused internal pop wrapper

Per review, the vm-taking Dict::pop wrapper was dead code (#[allow(dead_code)],
kept only for API symmetry) with no callers. Remove it and fold its doc into
pop_known_hash.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* dict: rename pop_known_hash to pop

Per review, with the plain pop gone the _known_hash suffix no longer earns
its keep, so drop it. Matches the remaining known-hash helpers that still
pair with a base method.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* dict: fold setdefault wrapper into setdefault, drop unused setdefault_entry

Per review, apply the same pattern as pop: the dead setdefault wrapper only
hashed and delegated, so remove it and rename setdefault_known_hash to
setdefault (callers already thread the hash). Also drop setdefault_entry,
which this PR added but nothing uses.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* dict: use set_cause and Result from fully_qualified_name

After rebasing onto main, fully_qualified_name returns PyResult
and set___cause__ is a private Python setter.

Assisted-by: Grok:4.6

* dict_inner: take a hash for every key operation

Drop the hashing wrappers and *_known_hash aliases. Callers hash
the key and pass it in.

Assisted-by: Grok:4.6

* snippets: add blank line before BadEq class

ruff format requires two blank lines before a top-level class.

Assisted-by: Grok:4.6

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2026-10-06 00:24:42 +09:00
youknowdot 6903fed201 Fix disabled stream identity and annotation operand checks (#8960)
Return the context's canonical None singleton when standard streams are
disabled. Check the exact set type before accessing user-rebindable
conditional-annotation tracking objects.

Both fixes apply to the unchanged Python 3.14 target. Include the no-stdio
embedding regression and the unchanged canonical regression from CPython's
3.14 maintenance backport c21e7c45, after the vulnerable 3.14.7 tag.

Extracted from the larger 3.15 migration; no marshal or version changes.

Assisted-by: Codex:model-version-unavailable
2026-10-05 09:03:18 +09:00
Kwak Byoung Min f39b054b9c Match CPython quotechar escaping when doublequote is disabled (#8953)
Let quote-only fields use the existing unquoted escaping path and enable
the existing CPython regression test.

Tested: test_csv, CSV snippet, 240 CPython comparisons, workspace and C-API tests, Clippy, prek
Assisted-by: Codex:gpt-6.1-sol
2026-10-04 13:53:35 +09:00
Alessio Attilio be3d12e96c implement _imp.create_dynamic and _imp.exec_dynamic (#8919)
Assisted-by: Gemini:gemini-3.7-flash
2026-10-02 09:25:33 +09:00
Jeong, YunWon cb0f3b012b Add a native _zoneinfo module (#8915)
* Add a native _zoneinfo module

ZoneInfo reads TZif tuples from zoneinfo._common.load_data. The stdlib
module implements utcoffset, dst, tzname, fromutc, and the zone cache.
whats_left compares that class. Cache tests no longer expect failure.

Assisted-by: Grok:grok-4.7

* Fix ZoneInfo layout and keep its cache on the module

utcoffset, dst, and tzname take the object. Zone data is boxed so the
payload lines up with tzinfo on 32-bit. The strong, weak, and timedelta
caches live on each interpreter's _zoneinfo module.

Assisted-by: Grok:grok-4.7
2026-10-01 11:32:32 +09:00
1ndahous3 74019cf627 Update concurrent.futures for Python 3.14 (#8904)
* Update concurrent.futures for Python 3.14

Assisted-by: Codex:GPT-6

* Enable relative import completion test

Assisted-by: Codex:GPT-6
2026-09-30 02:16:15 +09:00
Jeong, YunWon d54a4c5932 Set builtin __doc__, __module__, and datetime signatures (#8897)
* Set builtin __doc__, __module__, and datetime signatures

Expose empty doc-db member entries as ''. Heap __dict__ and __weakref__
getsets carry their descriptor docs. Member repr uses the qualified
type name.

__module__ is collections for the deque iterators, _csv for Dialect,
ctypes for ArgumentError and CField, _lzma for LZMAError, operator for
the getter types, pickle for PickleBuffer, _ssl for MemoryBIO,
SSLSession, _SSLContext and _SSLSocket, weakref for the proxy types,
and posix (nt on Windows) for times_result and uname_result.
unicodedata's copied UCD functions set __module__ to unicodedata.

_testinternalcapi function docs and weakproxy.__str__ use the stored
text. datetime replace defaults render as unchanged, __replace__ is
($self, /, **changes) and binds through replace, now defaults tz to
None, and fromisoformat and tzinfo methods name the parameter object.

Assisted-by: Grok:grok-4.7

* Move doctext helpers above the test module

db_slice and docs sat after mod tests.
Remove expectedFailure from test_html_doc, test_text_doc,
test_help_output_redirect, test_method_aliases, and test_long_signatures.

Assisted-by: Grok:grok-4.7
2026-09-29 21:11:06 +09:00