Commit Graph
17588 Commits
Author SHA1 Message Date
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
1ndahous3 3af5f8a153 Run benchmark workloads with consistent script namespaces (#9027)
Assisted-by: Codex:gpt-6
2026-10-10 09:25:57 +09:00
1ndahous3 11a8de1a87 Release array and list locks around fromlist conversions (#9030)
Assisted-by: Codex:gpt-6
2026-10-10 09:24:37 +09:00
Joshua Megnauth 5c40bb25af host_env: Use close_range syscall (FreeBSD/Linux) (#9016)
FreeBSD and Linux implement a syscall for close_range. It's faster than
looping through the file descriptors to close which would cause a
context switch per descriptor. CPython also uses the syscall where
available.

See:
* https://man.freebsd.org/cgi/man.cgi?close_range(2)
* https://man7.org/linux/man-pages/man2/close_range.2.html
* https://github.com/python/cpython/blob/5a22a62b96a68c2dd31784c5e3427ad7b365388a/Python/fileutils.c#L3193-L3231
2026-10-10 09:08:44 +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
youknowdot 59b36dd426 _zoneinfo: reject empty quoted POSIX TZ abbreviations (#9017)
* Reject empty quoted POSIX timezone abbreviations

Split the Python 3.14-compatible parser guard from #8954. Cover empty standard and daylight-saving abbreviations and preserve valid quoted names.

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep zoneinfo regression in module snippet

Rename the snippet as requested during review without changing test contents.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-09 23:29:16 +09:00
youknowdot 8986de27cc Preserve CSV dialect conversion errors and ordering (#9020)
Collect raw dialect fields and keyword overrides before converting them in CPython 3.14 order. Preserve truth-conversion exceptions, read classes without instantiating them, and retain defaulting for failed attribute lookup.

Use one shared parser for reader, writer, registry, and native dialect construction. Extend the existing CSV snippet with class, instance, direct-construction, lookup, override, conversion-order, and argument-binding regressions.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-09 23:28:56 +09:00
youknowdot fe984cec5d select: validate and expand Windows descriptor capacity (#9021)
* Cover Windows select capacity above the SDK default

Add local-socket readiness coverage for 65 entries and the Windows 512-entry limit, preserving 513-entry rejection. This regression-only commit intentionally leaves the current Windows 64-entry defect visible before the implementation is added.

AI assistance covered regression design, CPython 3.14 source comparison, and automated Linux baseline/reference testing. No manual Windows validation is claimed.

Assisted-by: Codex:model-version-unavailable

* Match Windows select capacity to Python 3.14

Use a 512-entry WinSock fd_set with checked C layout and scan its returned socket array. Keep the SDK default-size declaration at the FFI boundary only.

The preceding regression-only commit passed CPython 3.14.7 on hosted Windows and failed RustPython at the first 65-socket selection. Windows-GNU host_env cargo check and Clippy with warnings denied pass. The fixed native Windows runtime result 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-09 23:25:59 +09:00
youknowdot bd8fdb7e5c Handle math.log bases without premature float conversion (#9019)
Use the natural logarithm path for both operands, evaluating x first. Preserve large integer bases and raise ZeroDivisionError for base one while retaining noninteger conversion errors.

Split the Python 3.14-compatible behavior from #8954 without its additional __index__ fallback or changes to log2 and log10.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-09 20:56:40 +09:00
youknowdot 48419bd114 Skip overridden items for empty dictionaries in JSON encoding (#9018)
Split the Python 3.14-compatible empty native dictionary fast path from #8954. Extend the existing JSON snippet with root, nested, sorting, and nonempty subclass regression coverage.

Assisted-by: OpenAI Codex:model identifier unavailable
2026-10-09 20:55:36 +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 d0dfcb54e3 Synchronize mmap buffer exports with close and resize (#9015)
* Synchronize mmap buffer exports with close and resize

Assisted-by: Codex:gpt-6

* Keep mmap export checks ahead of data locks

Assisted-by: Codex:gpt-6
2026-10-09 18:29:43 +09:00
youknowdot cd623a9216 Prevent ContextVar cache hits after Context address reuse (#9009)
* Prevent ContextVar cache hits after Context address reuse

Give each Context, including copies, a non-reused cache identity instead
of using its heap address. Disable cache hits if the identity counter
saturates. This prevents an empty Context from reading a destroyed
Context's cached value while preserving existing locking and drop order.

Assisted-by: Codex:model-version-unavailable

* Cover ContextVar reads after context destruction

Exercise fresh and copied contexts with variable defaults, explicit defaults and missing values. The repeated lifecycle check complements canonical context tests without relying on a fixed allocator address-reuse count.

Assisted-by: Codex:model-version-unavailable

* Move ContextVar cache regression into the contextvars snippet

Preserve the fresh and copied Context lifetime checks, defaults and missing-value assertions while removing the redundant Rust interpreter wrapper.

Assisted-by: Codex:model-version-unavailable
2026-10-09 18:27:43 +09:00
youknowdot 98b280109f Return EBADF for negative stat file descriptors (#9008)
* Reject negative file descriptors before fstat

Return EBADF for negative ordinary descriptors before calling rustix, avoiding debug-build assertions on canonical invalid-fd tests. Keep directory-fd sentinel and absolute-path handling unchanged.

Assisted-by: Codex:model-version-unavailable

* Cover negative stat descriptors through the interpreter

Exercise ordinary negative descriptors including values accepted by rustix as directory sentinels, without changing canonical tests or directory-fd parsing.

Assisted-by: Codex:model-version-unavailable

* Move negative stat regression into the os snippet

Preserve the original Unix RustPython-only coverage and every regression assertion while removing the redundant Rust interpreter wrapper. CPython uses -1 as a path sentinel, so keep this regression scoped to its original runtime.

Assisted-by: Codex:model-version-unavailable
2026-10-09 18:27:10 +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
dependabot[bot] b6c60a5939 build(deps): bump mac_address (#9007)
Bumps the unix group with 1 update in the / directory: [mac_address](https://github.com/repnop/mac_address).


Updates `mac_address` from 1.1.8 to 1.2.0
- [Commits](https://github.com/repnop/mac_address/commits)

---
updated-dependencies:
- dependency-name: mac_address
  dependency-version: 1.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: unix
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-09 00:12:16 +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, YunWon 1e72b22470 Update malachite crates to 0.13.0 (#9003)
Assisted-by: Claude Code:claude-opus-5-5
2026-10-08 11:23:35 +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
dependabot[bot] 945469f294 build(deps): bump dns-lookup from 4.0.1 to 4.0.2 (#9002)
Bumps [dns-lookup](https://github.com/keeperofdakeys/dns-lookup) from 4.0.1 to 4.0.2.
- [Commits](https://github.com/keeperofdakeys/dns-lookup/compare/4.0.1...4.0.2)

---
updated-dependencies:
- dependency-name: dns-lookup
  dependency-version: 4.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-08 07:04:36 +09:00
Jeong, YunWon e053f7d5b6 vm: drop trailing space from RecursionError text (#8992)
* vm: drop trailing space from RecursionError text

Format Python-limit and native-stack RecursionError messages
through one helper so empty context is not a trailing space
or an empty string.

Assisted-by: Grok 4.6

* test: deepen nested hash snippets for release stack frames

The cold RecursionError helper thins with_recursion's hot frame,
so 100_000 nested hashes no longer trip the native stack guard
in release.

Assisted-by: Grok 4.6

* vm: let RecursionError callers own the where-clause space

The helper concatenates an empty suffix or one that already
starts with a space. Call sites supply that space.

Assisted-by: Grok 4.6
2026-10-08 00:58:39 +09:00
1ndahous3 f9ebb23447 Preserve Unix signal dispositions when probing handlers (#8961)
Assisted-by: Codex:gpt-6
2026-10-07 23:39:26 +09:00
dependabot[bot] 3d11c8b053 build(deps): bump rustls-pki-types from 1.15.0 to 1.15.1 (#9001)
Bumps [rustls-pki-types](https://github.com/rustls/pki-types) from 1.15.0 to 1.15.1.
- [Release notes](https://github.com/rustls/pki-types/releases)
- [Commits](https://github.com/rustls/pki-types/compare/v/1.15.0...v/1.15.1)

---
updated-dependencies:
- dependency-name: rustls-pki-types
  dependency-version: 1.15.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 14:39:09 +00:00
1ndahous3 a38bf3b54f Build host_env on Windows without the ctypes feature (#9000)
Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Codex:gpt-6
2026-10-07 23:33:55 +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
Jeongseop Lim a39d6c9676 Pass round() ndigits to __round__ unchanged (#8997)
round(x, ndigits) ran ndigits through __index__ before calling
__round__, so a user-defined __round__ never saw a non-integer ndigits
and an __index__ object reached it already converted to int. CPython's
builtin_round_impl() forwards ndigits as-is and leaves the conversion
to float.__round__ and int.__round__.

Forward the object, and take ndigits as ArgIndex in both slots so they
apply __index__ themselves. Calling the slots directly with an
__index__ object now works as in CPython instead of raising TypeError.

Assisted-by: Claude Code:claude-opus-5
Assisted-by: Claude Code:claude-opus-5-5
2026-10-07 23:18:55 +09:00
dependabot[bot] 0e67b82f52 build(deps): bump cc from 1.2.66 to 1.5.1 (#8994)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.2.66 to 1.5.1.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.66...cc-v1.5.1)

---
updated-dependencies:
- dependency-name: cc
  dependency-version: 1.5.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 05:32:20 +00:00
Jiwoo AhnandJeong YunWon ef5c651958 fix: signal.SIGINT and signal() raise NotImplementedError on wasi (#8986)
* fix: signal.SIGINT and signal() raise NotImplementedError on wasi

- Problem: signal.SIGINT and friends don't exist on wasi, and signal.signal()
  is hard-stubbed to raise NotImplementedError there
- Cause: wasi-libc emulates signal()/raise() in a separate opt-in library
  that Rust's own wasm32-wasip1 target distribution doesn't ship
- Fix: vendor wasi-sdk's prebuilt libwasi-emulated-signal.a, link it for
  wasm32-wasip1, and wire SIGINT/SIGABRT/SIGFPE/SIGILL/SIGSEGV/SIGTERM,
  signal()/getsignal()/raise_signal() through it. CPython's own WASI build
  links the same library

Assisted-by: Claude Code:claude-sonnet-5
Signed-off-by: Jiwoo Ahn <ikwydls1314@gmail.com>

* Group WASI signal definitions in mod wasm

Move WASI-only types, constants, FFI, and handlers into
`mod wasm` and re-export them with `#[cfg(target_os = "wasi")]`.

Assisted-by: Grok 4.6

---------

Signed-off-by: Jiwoo Ahn <ikwydls1314@gmail.com>
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2026-10-07 04:57:13 +00: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
dependabot[bot] 4b6ad58469 build(deps): bump rustix from 1.1.4 to 1.1.5 (#8990)
Bumps [rustix](https://github.com/bytecodealliance/rustix) from 1.1.4 to 1.1.5.
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGES.md)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v1.1.4...v1.1.5)

---
updated-dependencies:
- dependency-name: rustix
  dependency-version: 1.1.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 10:45:06 +09:00
dependabot[bot] 34a7d5ceb9 build(deps-dev): bump postcss-selector-parser in /wasm/demo (#8989)
Bumps [postcss-selector-parser](https://github.com/postcss/postcss-selector-parser) from 7.1.5 to 7.1.6.
- [Release notes](https://github.com/postcss/postcss-selector-parser/releases)
- [Changelog](https://github.com/postcss/postcss-selector-parser/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss-selector-parser/compare/7.1.5...7.1.6)

---
updated-dependencies:
- dependency-name: postcss-selector-parser
  dependency-version: 7.1.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 10:44:56 +09:00
dependabot[bot] 03c5720692 build(deps-dev): bump shell-quote from 1.10.0 to 1.12.0 in /wasm/demo (#8988)
Bumps [shell-quote](https://github.com/ljharb/shell-quote) from 1.10.0 to 1.12.0.
- [Changelog](https://github.com/ljharb/shell-quote/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/shell-quote/compare/v1.10.0...v1.12.0)

---
updated-dependencies:
- dependency-name: shell-quote
  dependency-version: 1.12.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 10:44:35 +09:00
dependabot[bot] abdf255335 build(deps-dev): bump source-map-js from 1.2.1 to 1.2.2 in /wasm/demo (#8987)
Bumps [source-map-js](https://github.com/7rulnik/source-map-js) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/7rulnik/source-map-js/releases)
- [Changelog](https://github.com/7rulnik/source-map-js/blob/main/CHANGELOG.md)
- [Commits](https://github.com/7rulnik/source-map-js/compare/v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: source-map-js
  dependency-version: 1.2.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 10:44:25 +09:00
dependabot[bot] 1fbb58bf01 build(deps): bump rustls from 0.23.43 to 0.23.45 (#8985)
Bumps [rustls](https://github.com/rustls/rustls) from 0.23.43 to 0.23.45.
- [Release notes](https://github.com/rustls/rustls/releases)
- [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustls/rustls/compare/v/0.23.43...v/0.23.45)

---
updated-dependencies:
- dependency-name: rustls
  dependency-version: 0.23.45
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 10:44:01 +09:00