Commit Graph
1025 Commits
Author SHA1 Message Date
youknowdot d7b4be2978 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
2026-10-11 07:36:19 +09:00
youknowdot 73ea4179d1 Merge current main into Python 3.15 migration
Preserve newly merged Python 3.14 compatibility work before applying the three required final-3.15 contract adjustments exposed by merge CI.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-11 07:27:28 +09:00
youknowdot eb6cefd765 Mark LRU cache wrappers as method descriptors (#9072)
Match the Python 3.14 wrapper type flag and enable the existing guarded method-call fast path. Keep the partial vectorcall changes separate.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 21:17:08 +00:00
youknowdot 44858012f4 Preserve missing caller modules in eager type aliases (#9073)
Only lazy aliases may obtain their module from the evaluation function. Eager aliases without a caller __name__ must not inspect their stored value.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 21:05:21 +00:00
youknowdot d23dc631ee Validate lock timeout range before acquire restrictions (#9061)
Preserve CPython signed nanosecond conversion precedence for reentrant and nonblocking acquisition, without changing the platform timeout maximum.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 17:55:52 +00:00
youknowdot 9d6bf4d224 Support directory descriptors in chmod (#9054)
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 13:17:16 +00:00
youknowdot 146bb809bb Validate sleep against signed nanosecond time bounds (#9051)
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 12:52:23 +00: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 b63c3b0134 Reuse exact dictionary hashes when merging call keywords (#9053)
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 12:33:20 +00:00
youknowdot bc495a8b30 Call descriptor __get__ attributes without pre-binding (#9043)
Extract the Python 3.14-compatible descriptor slot dispatch from #8954. Call the raw type attribute with descriptor, instance and owner, preserving ownership and recursion handling. Extend the existing Python snippet for staticmethod, classmethod, callable-object and ordinary __get__ replacements.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 11:56:48 +00:00
youknowdot 02917b6d9c Preserve reflected addition for sequence subclasses (#9049)
* Preserve reflected addition for native sequence subclasses

Extract the Python 3.14-compatible sequence-add slot distinction from #8954 without its unconditional numeric-slot clearing. Preserve stateful duplicate-slot behavior, exact descriptor identity, inherited reflected priority and a stable wrapper function address. Extend the existing addition snippet only for the uncovered inherited-native and slot-update cases.

Assisted-by: OpenAI Codex:model identifier unavailable

* Use stored MRO for sequence descriptor ownership

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 11:49:08 +00:00
youknowdot c0f0680297 Reject invalid character lengths before index conversion (#9052)
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 11:41:54 +00:00
youknowdot 082a48aec3 Preserve signed filesystem timestamps in os.utime (#9047)
Extract the Python 3.14-compatible signed timestamp conversion from #8954, preserving floor rounding, float-or-index argument rules and signed divmod remainders. Reuse the existing Windows file-time helper rather than the mega patch range restriction, and keep the 3.14 argument diagnostics. Add three concise parser regressions to the existing os snippet without native filesystem range assumptions.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 11:21:50 +00:00
youknowdot 64061cd38a Validate RLock acquisition arguments before reentrant success (#9035)
Extract the Python 3.14-compatible timeout validation order from #8954. Share validation with Lock and run it before increasing the RLock recursion count. Keep canonical general-lock coverage and add only owned-lock validation regressions to the existing thread snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 20:12:12 +09: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
youknowdot c516ca95df Preserve requested encoding names in codec lookup errors (#9036)
Extract the Python 3.14-compatible lookup diagnostic fix from #8954 while retaining the existing registry normalization. Cover original error spelling and normalized search-hook names in the existing codec snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 19:47:59 +09:00
youknowdot 386cd86aef Preserve FunctionType qualified names when overriding names (#9032)
Extract the independent Python 3.14-compatible constructor fix from #8954. An explicit name replaces __name__ while __qualname__ remains the code qualified name. Add a focused regression to the existing types snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 19:41:23 +09:00
youknowdot 1c7c801a3b Accept dict subclasses returned by module annotation functions (#9033)
Extract the Python 3.14-compatible annotation result check from #8954 without its Python 3.15 diagnostics. Preserve the returned dict subclass and cached identity, and cover the behavior in the existing module snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 19:36:57 +09:00
youknowdot 7079e70b79 Honor warning instance categories before validating category arguments (#9034)
Extract the Python 3.14-compatible ordering fix from #8954. An existing Warning instance determines its own category, regardless of the category argument. Keep canonical invalid-category coverage and add only the missing instance case to the existing warnings snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 19:36:20 +09:00
1ndahous3 dcdd5d45c3 Avoid copying strings when replace finds no match (#9029)
Assisted-by: Codex:gpt-6
2026-10-10 19:35:48 +09:00
youknowdot 7c9a0e32b3 Traverse references held by operator callables (#9044)
Extract attrgetter, itemgetter and methodcaller GC traversal from #8954. Add four bounded reference-cycle cases to the existing operator snippet, including a non-dotted str subclass retained by attrgetter.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 19:34:41 +09:00
youknowdot 9c8b745bfe Reject conflicting member layouts in multiple inheritance (#9041)
Extract the Python 3.14-compatible solid-base check from #8954. Prefix member cells contribute to instance layout even though they do not change basicsize. Include member_count in shape comparison while preserving all native layout safeguards, and cover conflicting and compatible bases in the existing type snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 19:34:12 +09:00
youknowdot 5dba000d8b Preserve raw mappingproxy rich-comparison results (#9039)
Extract the Python 3.14 comparison contract from #8954 without its 3.15 ordering restrictions or defensive copies. Return the wrapped mapping comparison result without truth conversion. Cover all six direct and reflected operations in the existing mappingproxy snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 19:33:32 +09:00
youknowdot e3374c8a24 Support pickling slot wrapper descriptors (#9037)
Extract wrapper descriptor reduction from #8954 for Python 3.14. Reduce to getattr on the defining class and cover direct reduction plus one roundtrip in the existing pickle snippet. Preserve canonical expected failures for unrelated staticmethod descriptor behavior.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 19:32:52 +09:00
youknowdot b725188965 Represent OrderedDict views with their contents (#9038)
Extract the Python 3.14-compatible view representation from #8954. Snapshot view elements before invoking their repr methods, preserve recursion handling, and cover each view in the existing collections snippet. Leave migration-specific mapping changes out.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 19:32:22 +09:00
youknowdot 1af8926c71 Isolate RustPython bytecode caches during the 3.15 transition
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 10:12:59 +09:00
youknowdot 4e854bbbbc Borrow mapping diagnostic keys as Python objects
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 09:59:39 +09:00
youknowdot b4468ee483 Reuse mapping format keys for lookup and error context
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 09:47:42 +09:00
youknowdot 1003f62a3d 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
2026-10-10 09:46:57 +09:00
youknowdot d51741677e 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
2026-10-10 09:46:31 +09:00
youknowdot 54dfc8d584 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
2026-10-10 09:46:31 +09:00
youknowdot 8573d916fc 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
2026-10-10 09:01:35 +09:00
youknowdot 33198c7578 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
2026-10-10 08:45:02 +09:00
youknowdot 2002f530dc Limit in-place specialization additions to exact sequence repetition
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 01:00:58 +09:00
youknowdot 72a6330b3c 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
2026-10-10 00:59:33 +09:00
youknowdot 519370bece 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
2026-10-10 00:53:45 +09:00
youknowdot 6c2529800a 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
2026-10-10 00:53:45 +09:00
youknowdotandJeong YunWon f5b6526c49 Support compile(module=...) across AST warning paths (#8947)
* Support compile module context across AST warning paths

Add Python 3.15 compile(module=...) warning filtering. Move format-spec diagnostics to a fallible, literal-aware AST boundary; preserve nested literal warnings while excluding raw text and comments, map function-type fragments to source locations, and suppress duplicate type-comment emissions with per-call tracking.

Keep unrelated legacy warning-detection and exact diagnostic metadata gaps documented by differential probes. Add focused flag, source-location, exception, reentrancy, filtering and literal-boundary regression coverage.

Assisted-by: Codex:model-version-unavailable

* Adapt compile module context to the current parser APIs

Convert the single-mode multiple statements error into the generic
parse error type, and iterate f-string parts through FStringPartRef.

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

---------

Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2026-10-10 00:50:55 +09: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
youknowdot 42778444a8 Preserve defaultdict subclasses in union results (#9026)
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-10 00:47:49 +09:00
youknowdot 87aedfb7c5 Preserve Windows time conversion error classes (#9022)
* Cover Windows time conversion error classes

Require OSError with EINVAL for representable timestamps rejected by the Windows C runtime, while preserving OverflowError for float(2**63). This initial regression-only commit intentionally exposes the current Windows error mapping before the implementation follows.

AI assistance covered source comparison, regression design, and automated Linux baseline/reference controls. Native Windows results are pending. No human validation is claimed.

Assisted-by: Codex:model-version-unavailable

* Record native Windows time conversion outcomes

The first hosted regression run failed on CPython 3.14.7 as well as RustPython because a presumed-invalid CRT timestamp succeeded. Add bounded diagnostics before the unchanged assertions to capture full version/build metadata and every conversion result, including negative half-day controls. No implementation or canonical test changes are included.

The existing time snippet still passes the repository pytest runner on Linux CPython 3.14.7 and the current RustPython baseline. Native diagnostic results remain pending.

Assisted-by: Codex:model-version-unavailable

* Use the observed UCRT rejection boundary in time regression

Hosted Windows diagnostics show that CPython 3.14.7 and RustPython both accept gmtime(-1) and gmtime(-43200), while -86400 is rejected by all three converters. Correct only the newly added shared negative test value. CPython raises OSError(errno 22) for every selected rejected value, while the RustPython baseline raises OverflowError. Canonical tests and the recorded diagnostics remain unchanged.

The existing snippet passes both Linux reference and baseline controls. Assisted source investigation and automated verification used no manual validation.

Assisted-by: Codex:model-version-unavailable

* Preserve Windows CRT time conversion errors

Return CRT errno failures from the Windows calendar helpers and translate them to Python OSError. Adapt the datetime caller while retaining its Unix behavior. Use an exclusive signed float upper bound so float(2**63) still raises OverflowError before reaching the CRT.

Keep Windows negative-time FILETIME fallback and time64 ABI changes outside this Python 3.14 extraction. Existing datetime local-error coverage is retained and a UTC error control is added for the observed rejected timestamp -86400.

Hosted native diagnostics prove CPython 3.14.7 raises OSError(errno 22) where the baseline raises OverflowError. Windows-GNU host_env check and warnings-denied Clippy pass. Selected canonical datetime and complete time/datetime snippet Linux controls pass, with six existing baseline canonical skips. Fixed native Windows verification remains pending CI.

AI assistance covered source comparison, implementation, regression design, and automated verification. No manual validation is claimed.

Assisted-by: Codex:model-version-unavailable
2026-10-10 00:41:40 +09:00
youknowdot d4b43b860d Translate WASI signal dispositions through libc sentinels (#9024)
Keep Python disposition values distinct from WASI function-table pointers. Recognize wasi-libc SIG_ERR before updating Python handlers and preserve ignored/default/custom dispositions. Add synchronous signal and rejected-registration regressions to the existing snippet.

AI assistance covered source investigation, implementation, and automated reference/baseline tests. Isolated patched runtime validation is pending. No human validation is claimed.

Assisted-by: Codex:model-version-unavailable
2026-10-09 23:59:43 +09:00
youknowdot bf984b465e Fix itertools.compress iterator consumption order (#9025)
Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-09 23:58:08 +09:00
Bas Schoenmaeckers e6cbf3628d Add buffer support to c-api (#8071)
* Add buffer support to c-api

* Review

* Refactor PyBuffer

* Manual implement `PyBuffer_GetPointer`

* Review

* Store in 1 Box
2026-10-09 20:00:59 +09:00
1ndahous3 0943b4813b Guard untracked frames against recursive deallocation (#9013)
Assisted-by: Codex:gpt-6
2026-10-09 08:04:25 +09:00
1ndahous3 06389eb2ac Make the PySubclass layout contract unsafe (#9012)
Assisted-by: Codex:gpt-6
2026-10-09 08:03:19 +09:00
youknowdot 54e47cda21 Fix os.closerange and immediate process exit (#9006)
* Ignore invalid descriptors in os.closerange

Close raw descriptor numbers through the host CRT layer rather than constructing OwnedFd values for possibly closed descriptors. Preserve the half-open range, ignored close errors and Windows invalid-parameter handling.

Assisted-by: Codex:model-version-unavailable

* Use immediate exit for host process termination

Python os._exit, failed child exec and fatal/watchdog exits must bypass C exit handlers. Call the host CRT _exit on Unix, Windows and WASI while retaining the existing non-host fallback. Normal interpreter termination is unchanged.

Assisted-by: Codex:model-version-unavailable
2026-10-09 00:13:00 +09:00
Jeong, YunWon bb9ef5d0c2 Infer native calling convention flags from argument metadata (#9005)
`PyMethodDef::new_const`, `PyMethodDef::new_raw_const` and
`Context::new_method_def` add the calling convention (`NOARGS`, `O`,
`FASTCALL`, or `FASTCALL | KEYWORDS`) inferred from the
`FromArgs::PARAMS` of each argument, exposed as `IntoPyNativeFn::ARGS`.
Flags that already contain a calling convention, such as C-API
`ml_flags`, are kept. For `METHOD` and `CLASS` the first argument is the
bound receiver. Raw functions get `FASTCALL | KEYWORDS`.

The derive macros pass only binding flags and no longer infer call flags
from Rust type names. Definitions built without the macros, such as the
`__new__` wrapper and `vm.new_function`, get calling convention flags the
same way.

Assisted-by: Claude Code:claude-opus-5-5
2026-10-08 17:43:30 +09:00
Jeong, YunWon ca9dbb40f8 Give builtin_method its own type (#9004)
Split `builtin_method` out as a subclass of `builtin_function_or_method`.
Ordinary descriptor bind and `__new__` wrappers allocate a CFunction;
only `build_bound_method` uses the METH_METHOD payload. Keep
`types.BuiltinMethodType` as an alias of `BuiltinFunctionType`.

Assisted-by: Grok 4.6
2026-10-08 14:01:52 +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