16338 Commits
Author SHA1 Message Date
Lee Dogeon 1614e88b97 Implement missing slots for NoneType (#7437)
* Define only wrapper_descriptor

* Implement missing slots for NoneType
2026-03-16 11:58:40 +09:00
Jeong, YunWon d8a52ff3ed Mark RustPython 0.5.0 2026-03-16 11:32:27 +09:00
ShaharNaveh 6cc516ec56 Update _test_eintr.py from 3.14.3 2026-03-16 00:10:09 +09:00
Lee Dogeon f5b1ea7c60 Preserve imaginary zero signs when adding real values to complex numbers (#7421)
* Preserve imaginary zero signs when adding real values to complex numbers

* Refactor complex_add with match expression

* Correct complex real subtract op

* Remove unnecessary vm arugment
2026-03-15 17:04:23 +09:00
Shahar Naveh 92135de258 Newtype var_nums oparg (#7431) 2026-03-15 17:01:03 +09:00
Shahar Naveh 44b4eff2fe Don't trigger update libs status on forks (#7428) 2026-03-14 20:23:08 +09:00
Shahar Naveh 17ac73888d Update ruff to 0.15.6 (#7427)
* Update ruff to `0.15.6`

* Unmark passing tests
2026-03-14 20:22:42 +09:00
Lee Dogeon 3f1ce34422 Match divmod zero-division message with CPython (#7426) 2026-03-14 20:21:23 +09:00
Jeong, YunWon e9ba43935e Upgrade pymath to 0.2.0 (#7429) 2026-03-14 20:13:30 +09:00
Jiseok CHOI ccad9c168a Fix sqlite3 Cursor.fetchmany to not fetch rows when size=0 (#7425) 2026-03-14 15:49:55 +09:00
Lee Dogeon 257cf6fa0e Match __module__ setter behavior to CPython (#7424)
* Remove stale __firstlineno__ when updating type.__module__

* Register and use __firstlineno__ as identifier
2026-03-14 15:48:48 +09:00
Lee Dogeon ae73aab6a4 Handle chr() range checks without Rust integer overflow (#7422) 2026-03-14 15:47:45 +09:00
Lee Dogeon 3106c30d58 Make singleton builtin types immutable (#7423) 2026-03-14 09:45:43 +09:00
Shahar NavehandLee Dogeon 692c777e48 Update test_marshal.py from 3.14.3 (#7409)
---------

Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2026-03-14 09:45:12 +09:00
Jeong, YunWon 13a0623eb1 Adapt bitflagset to use enum (#7419) 2026-03-14 09:44:02 +09:00
Jiseok CHOI 7e2154f382 Fix classmethod descr_get to match CPython behavior (#7420)
Simplify classmethod.__get__ to always create a PyBoundMethod binding
  the callable to the class, matching CPython's cm_descr_get which simply
  calls PyMethod_New(cm->cm_callable, type).

  The previous implementation incorrectly tried to call __get__ on the
  wrapped callable, which broke when a bound method was passed to
  classmethod() (e.g. classmethod(A().foo)).
2026-03-14 03:40:16 +09:00
Jeong, YunWon 6062c58aec Fix SSL read over-consuming TCP data (#7418)
Use single-record reading (recv_one_tls_record) for all SSL
reads, not just handshake. This prevents rustls from eagerly
consuming close_notify alongside application data, which left
the TCP buffer empty and caused select()-based servers to miss
readability and time out.

Also fix recv_one_tls_record to return Eof (not WantRead) when
peek returns empty bytes, since empty peek means the peer has
closed the TCP connection.
2026-03-13 21:02:31 +09:00
Jeong, YunWon e26aa9640b Fix SSL handshake over-reading in STARTTLS (#7417)
During STARTTLS handshake, sock_recv(16KB) could consume
application data that arrived alongside handshake records.
The consumed data ended up in rustls's internal buffer where
select() could not detect it, causing asyncore-based servers
to miss readable events and the peer to time out.

Use MSG_PEEK to find the TLS record boundary, then recv()
only one complete record. Remaining data stays in the kernel
TCP buffer, visible to select(). This matches OpenSSL's
default no-read-ahead behaviour.

Fixes flaky test_poplib (TestPOP3_TLSClass) failures.
2026-03-13 11:46:35 +09:00
김은빈 85d4aeaa45 Fix weakref proxy number protocol, right-side ops, and non-iterator error (#7410) 2026-03-13 11:36:16 +09:00
dependabot[bot] a223d9a8b0 Bump memmap2 from 0.9.9 to 0.9.10 (#7415)
Bumps [memmap2](https://github.com/RazrFalcon/memmap2-rs) from 0.9.9 to 0.9.10.
- [Changelog](https://github.com/RazrFalcon/memmap2-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/RazrFalcon/memmap2-rs/compare/v0.9.9...v0.9.10)

---
updated-dependencies:
- dependency-name: memmap2
  dependency-version: 0.9.10
  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-03-13 10:19:04 +09:00
dependabot[bot] 1d29813249 Bump quote from 1.0.44 to 1.0.45 (#7414)
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.44 to 1.0.45.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.44...1.0.45)

---
updated-dependencies:
- dependency-name: quote
  dependency-version: 1.0.45
  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-03-13 08:53:48 +09:00
dependabot[bot] 3a6bb4e839 Bump the openssl group with 2 updates (#7413)
Bumps the openssl group with 2 updates: [openssl](https://github.com/rust-openssl/rust-openssl) and [openssl-sys](https://github.com/rust-openssl/rust-openssl).


Updates `openssl` from 0.10.75 to 0.10.76
- [Release notes](https://github.com/rust-openssl/rust-openssl/releases)
- [Commits](https://github.com/rust-openssl/rust-openssl/compare/openssl-v0.10.75...openssl-v0.10.76)

Updates `openssl-sys` from 0.9.111 to 0.9.112
- [Release notes](https://github.com/rust-openssl/rust-openssl/releases)
- [Commits](https://github.com/rust-openssl/rust-openssl/compare/openssl-sys-v0.9.111...openssl-sys-v0.9.112)

---
updated-dependencies:
- dependency-name: openssl
  dependency-version: 0.10.76
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: openssl
- dependency-name: openssl-sys
  dependency-version: 0.9.112
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: openssl
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-13 08:53:28 +09:00
Jeong, YunWon fabc571fc6 Merge pull request #7411 from youknowone/ci-format
Fix pr-format CI to fail on formatting changes
2026-03-13 08:53:01 +09:00
Shahar Naveh f5a0e37e1c Upgrade libc to 0.2.183 (#7406) 2026-03-13 01:21:18 +09:00
EtherealPsyche 18147fda61 If the host_env feature is enabled, then enable the _ctypes module on the Android platform. (#7402) 2026-03-13 01:20:32 +09:00
Jeong, YunWon c06cf05dea fmt 2026-03-13 01:19:10 +09:00
Jeong, YunWon acb9937c49 Fix pr-format CI to fail on formatting changes
Add git diff --exit-code step to fail the check when
formatters produce changes. Previously reviewdog only
posted suggestions without failing the workflow.
2026-03-13 01:19:10 +09:00
김은빈 76556540d1 Add strict parameter to map() builtin (#7405)
* Add strict parameter to map() builtin

* Refactor map IterNext to match zip style
2026-03-12 15:02:53 +00:00
Jeong, YunWon 18122a31b9 Merge pull request #7408 from ShaharNaveh/update-test-gen
Update generator related tests from 3.14.3
2026-03-12 23:47:31 +09:00
Jeong, YunWon a7c2c1d3f2 Merge pull request #7404 from moreal/bump-3.14.3-modulefinder
Bump 3.14.3 modulefinder
2026-03-12 23:42:27 +09:00
Shahar Naveh 6c8f19e0d2 Newtype oparg align methods (#7403)
* Align methods for newtype opargs
2026-03-12 23:41:21 +09:00
ShaharNaveh 17b9986a6e Update test_yield_from.py from 3.14.3 2026-03-12 13:33:04 +01:00
ShaharNaveh 60a9beabd9 Mark failing tests 2026-03-12 13:24:29 +01:00
ShaharNaveh af7aaea6b3 Update test_generators.py from 3.14.3 2026-03-12 13:21:30 +01:00
ShaharNaveh 47749d2859 Add test_generator_stop.py from 3.14.3 2026-03-12 13:19:19 +01:00
Lee DogeonandClaude Opus 4.6 431766912b Mark failing tests for modulefinder
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 20:52:26 +09:00
CPython Developers 6255752cfb Update modulefinder from v3.14.3 2026-03-12 20:52:24 +09:00
Jeong, YunWonandCPython Developers 23c8eb80fb gc: add CollectResult, stats fields, get_referrers, and fix count reset (#7354)
* gc: add CollectResult, stats fields, get_referrers, and fix count reset

- Add CollectResult struct with collected/uncollectable/candidates/duration
- Add candidates and duration fields to GcStats and gc.get_stats()
- Pass CollectResult to gc.callbacks info dict
- Reset generation counts for all collected generations (0..=N)
- Return 0 for third value in gc.get_threshold() (3.13+)
- Implement gc.get_referrers() by scanning all tracked objects
- Add DEBUG_COLLECTABLE output for collectable objects
- Update test_gc.py to expect candidates/duration in stats

* Update test_gc from v3.14.3

* Update test_gc.py from CPython v3.15.0a5

Taken from v3.15 (not v3.14.3) because get_stats() candidates/duration
fields were added in 3.13+ and the corresponding test assertions only
exist in 3.15.

* Fix gc_state build on wasm32: skip Instant timing

* Add candidates/duration to gc callback info, mark v3.15 test failures

* Fix gc.get_referrers to exclude executing frames, fix Future cancelled exc leak

- get_referrers: skip frame objects on the execution stack, since
  they are not GC-tracked in CPython (_PyInterpreterFrame)
- _asyncio Future/Task make_cancelled_error_impl: clear the stored
  cancelled exception after returning it, matching the Python
  _make_cancelled_error behavior

* Fix gc.get_threshold to return actual gen2 threshold value

* Fix inconsistent GC count reset in early-return paths

Use the same reset_end formula in unreachable-empty early returns
as in the main collection path and collecting-empty path.

* Accept keyword arguments in socket.__init__

Use a FromArgs struct instead of a positional-only tuple so that
family, type, proto, and fileno can be passed as keyword arguments.

* Disable comp_inlined in symbol table to match compiler

The compiler does not yet implement PEP 709 inlined comprehensions
(is_inlined_comprehension_context always returns false), but the
symbol table was marking comprehensions as inlined. This mismatch
could cause comprehension-local symbols to be merged into the parent
scope while the compiler still looks them up in a separate scope.

---------

Co-authored-by: CPython Developers <>
2026-03-12 20:48:22 +09:00
CPython Developers 2853cca4c8 Update poplib from v3.14.3 2026-03-12 18:08:56 +09:00
dependabot[bot] 9a9f9db0c2 Bump socket2 from 0.6.2 to 0.6.3 (#7373)
Bumps [socket2](https://github.com/rust-lang/socket2) from 0.6.2 to 0.6.3.
- [Release notes](https://github.com/rust-lang/socket2/releases)
- [Changelog](https://github.com/rust-lang/socket2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/socket2/compare/v0.6.2...v0.6.3)

---
updated-dependencies:
- dependency-name: socket2
  dependency-version: 0.6.3
  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-03-12 11:00:24 +09:00
Shahar Naveh fb41218ef5 Enable jit on macos (#7401) 2026-03-12 09:20:24 +09:00
Shahar Naveh 608f13cb62 Newtype var_num oparg (#7400) 2026-03-12 09:20:01 +09:00
Shahar Naveh e046877025 Use matrix for cargo check (#7388)
* Use matrix for cargo_check

* Tweak `gcc-aarch64-linux-gnu` deps

* Re-add redox comment
2026-03-11 22:21:25 +09:00
Jeong, YunWon e97f1c8bdf Fix atexit unraisable exception message format (#7399)
* Fix atexit unraisable exception message format

Match PyErr_FormatUnraisable behavior: use
"Exception ignored in atexit callback {func!r}" as err_msg
and pass None as object instead of the callback function.

* Fix atexit unregister deadlock with reentrant __eq__

Release the lock during equality comparison in unregister so
that __eq__ can safely call atexit.unregister or atexit._clear.
Store callbacks in LIFO order (insert at front) and use
identity-based search after comparison to handle list mutations,
matching atexitmodule.c behavior.

Also pass None as err_msg when func.repr() fails, matching
CPython's PyErr_FormatUnraisable fallback.
2026-03-11 22:20:37 +09:00
Jeong, YunWon 3ef45abbce Refine specialization caches and extend binary-op coverage (#7386)
* Align BINARY_OP_EXTEND with CPython descriptor cache model

* Align type _spec_cache and latin1 singleton string paths

* Add specialization differential harness and align init error text

* Tighten CALL_ALLOC_AND_ENTER_INIT stack-space guard

* Align call-init frame flow and spec cache atomic ordering

* Refine call-init recursion guard and cache swap lifetime handling

* Align spec cache write locking with CPython contract

* Align load attr miss cooldown with CPython

* Align CALL descriptor and class-call specialization with CPython

* Extract datastack_frame_size_bytes_for_code, skip monitoring for init_cleanup frames, guard trace dispatch

- Extract datastack_frame_size_bytes_for_code as free function, use it
  to compute init_cleanup stack bytes instead of hardcoded constant
- Add monitoring_disabled_for_code to skip instrumentation for
  synthetic init_cleanup code object in RESUME and execute_instrumented
- Add is_trace_event guard so profile-only events skip trace_func dispatch
2026-03-10 15:39:55 +09:00
Jeong, YunWon 630cd8d715 Rename stdlib files to match Python module names (#7397) 2026-03-10 15:29:17 +09:00
Jeong, YunWon 0324b13cd3 Save errno inside allow_threads in semaphore acquire (#7391)
allow_threads may call attach_thread() on return, which
can invoke syscalls that clobber errno. Capture errno
inside the closure before it is lost.
2026-03-10 14:04:28 +09:00
Jeong, YunWon 1ddb95442a Fix parking lot hash table after fork (#6963)
* Use patched parking_lot_core with fork-safe HASHTABLE reset

parking_lot_core's global HASHTABLE retains stale ThreadData after
fork(), causing segfaults when contended locks enter park(). Use the
patched version from youknowone/parking_lot (rustpython branch) which
registers a pthread_atfork handler to reset the hash table.

Unskip test_asyncio TestFork. Add Manager+fork integration test.

* Unskip fork-related flaky tests after parking_lot fix

With parking_lot_core's HASHTABLE now properly reset via
pthread_atfork, fork-related segfaults and connection errors
in multiprocessing tests should be resolved.

Remove skip/expectedFailure markers from:
- test_concurrent_futures/test_wait.py (6 tests)
- test_concurrent_futures/test_process_pool.py (1 test)
- test_multiprocessing_fork/test_manager.py (all WithManagerTest*)
- test_multiprocessing_fork/test_misc.py (5 tests)
- test_multiprocessing_fork/test_threads.py (2 tests)
- _test_multiprocessing.py (2 shared_memory tests)

Keep test_repr_rlock skipped (flaky thread start latency,
not fork-related).
2026-03-10 12:57:29 +09:00
Jeong, YunWonShaharNavehCPython Developers
cfca3bf397 Implement _tokenize and update tokenize from v3.14.3 (#7392)
* Base implementation of _tokenize module

Port from PR #6240 by ShaharNaveh, adapted to current codebase.
Uses ruff_python_parser for tokenization via TokenizerIter.

* Update tokenize from v3.14.3

* Rewrite _tokenize with 2-phase model

Replace per-line reparsing with single-pass tokenization:
- Read all lines via readline, parse once, yield tokens
- Fix token type values (COMMENT=65, NL=66, OP=55)
- Fix NEWLINE/NL end positions and implicit newline handling
- Fix DEDENT positions via look-ahead to next non-DEDENT token
- Handle FSTRING_MIDDLE brace unescaping ({{ → {, }} → })
- Emit implicit NL before ENDMARKER when source lacks trailing newline
- Raise IndentationError from lexer errors
- Remove 13 expectedFailure marks for now-passing tests

---------

Co-authored-by: ShaharNaveh <shaharnaveh@users.noreply.github.com>
Co-authored-by: CPython Developers <>
2026-03-10 12:27:09 +09:00
dependabot[bot] bd8eca0696 Bump insta from 1.46.1 to 1.46.3 (#7394)
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.46.1 to 1.46.3.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.46.1...1.46.3)

---
updated-dependencies:
- dependency-name: insta
  dependency-version: 1.46.3
  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-03-10 11:50:31 +09:00