Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sheeeng/rustpython-rustpython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 06f73f2
Choose a base ref
...
head repository: RustPython/RustPython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 52305c0
Choose a head ref
  • 16 commits
  • 63 files changed
  • 5 contributors

Commits on May 22, 2026

  1. Configuration menu
    Copy the full SHA
    ab5bc43 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4eb9534 View commit details
    Browse the repository at this point in the history
  3. Rustls integration improvements (RustPython#7946)

    * Do not call `import socket` on each send()/recv() when using rustls
    
    Use method references cached during socket creation.
    
    * Implement reading of at most one TLS record from socket
    
    Previous algorithm didn't take into account that recv() may return less
    data than requested even for blocking sockets.
    
    * Remove special handling of rustls "buffer full" errors
    
    First of all, existing code does not really work and this leads to an
    infinite loop: RustPython#7891
    
    Second, this should never happen when rustls used properly (wrt
    wants_read() and wants_write()) and thus all such errors are
    implementation bugs that must be properly fixed.
    
    * Replace own TlsConnection with rustls::Connection
    
    * Fix waiting on a socket
    
    1) Ensure that socket_wait() called from TLS glue code allows threads
    2) Ensure that socket_wait() called from TLS glue code properly handles
       EINTR on *nix
    3) Ensure that select() or poll() error conditions are checked
    4) Use poll() on *nix so socket descriptor values are not limited
    
    * Remove dead code from rustls glue
    
    * Do not present rustls errors as OSError(0, "Success")
    
    * Remove infinite loop "detection" from rustls glue
    
    TLS handshake cannot be infinite. Any infinite loop here is a serious
    bug in implementation and should be fixed properly.
    
    This code triggers in some cases (very short reads) with misleading
    `ssl_error.SSLWantReadError: The operation did not complete (read)`.
    
    * Add test for 1-byte max recv in TLS client
    
    * Add regression test for RustPython#7891
    
    * Fix constants in rustls glue code
    
    * Deduplicate verify flags / record-size constants
    * Larger "max encrypted TLS record length"
    im-0 authored May 22, 2026
    Configuration menu
    Copy the full SHA
    2a16360 View commit details
    Browse the repository at this point in the history
  4. Fix panic in select.select() when too many FDs specified (RustPython#…

    …7948)
    
    Also:
    
    * Add regression test into existing `extra_tests/snippets/stdlib_select.py`
    * Stop calculating nfds on Windows as it is ignored there
    
    Panic:
    
    	thread 'main' (189598) panicked at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.186/src/unix/linux_like/mod.rs:1777:9:
    	index out of bounds: the len is 16 but the index is 16
    	note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    	thread 'main' (189598) panicked at library/core/src/panicking.rs:225:5:
    	panic in a function that cannot unwind
    	stack backtrace:
    	   0:     0xaaab763a0b88 - <<std[1934960bf7f41d0a]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f1abae5f1257fe69]::fmt::Display>::fmt
    	   1:     0xaaab75590ff0 - core[f1abae5f1257fe69]::fmt::write
    	   2:     0xaaab763a94fc - <std[1934960bf7f41d0a]::sys::stdio::unix::Stderr as std[1934960bf7f41d0a]::io::Write>::write_fmt
    	   3:     0xaaab7638b714 - std[1934960bf7f41d0a]::panicking::default_hook::{closure#0}
    	   4:     0xaaab7639b288 - std[1934960bf7f41d0a]::panicking::default_hook
    	   5:     0xaaab7639b478 - std[1934960bf7f41d0a]::panicking::panic_with_hook
    	   6:     0xaaab7638b7ec - std[1934960bf7f41d0a]::panicking::panic_handler::{closure#0}
    	   7:     0xaaab76382654 - std[1934960bf7f41d0a]::sys::backtrace::__rust_end_short_backtrace::<std[1934960bf7f41d0a]::panicking::panic_handler::{closure#0}, !>
    	   8:     0xaaab7638c504 - __rustc[b7425922bef61dcf]::rust_begin_unwind
    	   9:     0xaaab754f778c - core[f1abae5f1257fe69]::panicking::panic_nounwind_fmt
    	  10:     0xaaab754f7714 - core[f1abae5f1257fe69]::panicking::panic_nounwind
    	  11:     0xaaab754f786c - core[f1abae5f1257fe69]::panicking::panic_cannot_unwind
    	  12:     0xaaab75a6283c - rustpython_vm::function::builtin::<impl rustpython_vm::function::builtin::sealed::PyNativeFnInternal<(rustpython_vm::function::builtin::OwnedParam<T1>,rustpython_vm::function::builtin::OwnedParam<T2>,rustpython_vm::function::builtin::OwnedParam<T3>,rustpython_vm::function::builtin::OwnedParam<T4>),R,rustpython_vm::vm::VirtualMachine> for F>::call_::h2471c8e242c9b51d
    	  13:     0xaaab75db1e68 - rustpython_vm::types::slot::Callable::slot_call::hd1c1ad0ad14f306b
    	  14:     0xaaab762c0a50 - rustpython_vm::protocol::callable::PyCallable::invoke::h9f6d571fca351ca6
    	  15:     0xaaab75c550e8 - rustpython_vm::protocol::callable::<impl rustpython_vm::object::core::PyObject>::call_with_args::hed1f4a61aba2dced
    	  16:     0xaaab762e7c24 - rustpython_vm::frame::ExecutingFrame::execute_call::h0ad3490dd74ed1e3
    	  17:     0xaaab762fed40 - rustpython_vm::frame::ExecutingFrame::run::hcf90f0950fc26812
    	  18:     0xaaab761e6768 - rustpython_vm::vm::VirtualMachine::with_frame::hd49ba6fcdf2422e2
    	  19:     0xaaab75c45398 - rustpython_vm::builtins::function::<impl rustpython_vm::object::core::Py<rustpython_vm::builtins::function::PyFunction>>::invoke_with_locals::h42de3d2316941ce2
    	  20:     0xaaab76132a80 - rustpython_vm::builtins::function::vectorcall_function::h7331cb67b334e867
    	  21:     0xaaab763369d8 - rustpython_vm::protocol::callable::<impl rustpython_vm::object::core::PyObject>::vectorcall::h9019c5d16685c89a
    	  22:     0xaaab762f4b54 - rustpython_vm::frame::ExecutingFrame::execute_call_vectorcall::h120134e11a58c946
    	  23:     0xaaab76302a7c - rustpython_vm::frame::ExecutingFrame::run::hcf90f0950fc26812
    	  24:     0xaaab761e6768 - rustpython_vm::vm::VirtualMachine::with_frame::hd49ba6fcdf2422e2
    	  25:     0xaaab761e7f24 - rustpython_vm::vm::VirtualMachine::run_code_obj::h354618be6e5cc553
    	  26:     0xaaab761e2d18 - rustpython_vm::vm::python_run::file_run::<impl rustpython_vm::vm::VirtualMachine>::run_any_file::h783d3127fbc0b523
    	  27:     0xaaab757d700c - rustpython::run_rustpython::h354efb8d817cefbf
    	  28:     0xaaab757c79e0 - std::thread::local::LocalKey<T>::with::hc9728e249843a926
    	  29:     0xaaab757db860 - rustpython_vm::vm::interpreter::Interpreter::run::h42ac1fe9ed2287a2
    	  30:     0xaaab757d7b30 - rustpython::run::hf14a209db5b4289c
    	  31:     0xaaab757e2eb4 - rustpython::main::h1b59d8e13276ac48
    	  32:     0xaaab757e2eec - std::sys::backtrace::__rust_begin_short_backtrace::h47e4b1f073f2155c
    	  33:     0xaaab757e2ed4 - std::rt::lang_start::{{closure}}::h663a6c3dc7d80101
    	  34:     0xaaab76399fd4 - std[1934960bf7f41d0a]::rt::lang_start_internal
    	  35:     0xaaab757e2f44 - main
    	  36:     0xfffed057655c - __libc_start_call_main
    	  37:     0xfffed057663c - __libc_start_main@@GLIBC_2.34
    	  38:     0xaaab755526f0 - _start
    	  39:                0x0 - <unknown>
    	thread caused non-unwinding panic. aborting.
    	Aborted                    (core dumped) cargo run --release -- extra_tests/snippets/stdlib_select.py
    im-0 authored May 22, 2026
    Configuration menu
    Copy the full SHA
    cf3b639 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c513b92 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    1a01393 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f3b83ef View commit details
    Browse the repository at this point in the history

Commits on May 23, 2026

  1. Configuration menu
    Copy the full SHA
    d3272e7 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2026

  1. Add missing test for select.select() (RustPython#7953)

    This is a follow up for RustPython#7948
    im-0 authored May 24, 2026
    Configuration menu
    Copy the full SHA
    b9efe10 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e1d9a11 View commit details
    Browse the repository at this point in the history
  3. Align marshal and .pyc with CPython 3.14 (RustPython#7958)

    * Share marshal ref table between code object and its internals
    
    read_marshal_bytes, _str, _str_vec, _name_tuple, and _const_tuple now
    take a shared ref table and resolve TYPE_REF / register FLAG_REF
    entries. deserialize_code is split into a public wrapper and an inner
    function that receives the ref table; deserialize_value_depth opens a
    fresh inner ref space when it hits Type::Code, mirroring CPython's
    behaviour of putting the code object itself at ref slot 0. Nested code
    objects inside const tuples reuse the surrounding code's ref space via
    the new read_const_value helper.
    
    * Align PYC magic number, FORMAT_VERSION, and header check with CPython 3.14
    
    PYC_MAGIC_NUMBER changes from 2994 to 3627, matching CPython 3.14's
    pyc_magic_number_token (0x0a0d0e2b). marshal FORMAT_VERSION drops from
    5 to 4 (the encoder/marshal.version value; the decoder already accepts
    both). check_pyc_magic_number_bytes now compares all four magic bytes
    instead of the first two.
    
    * Add CPython 3.14 .pyc decoding regression tests
    
    Two fixture-based tests pin the marshal decoder against actual CPython
    3.14 marshal.dumps() output: a trivial module that exercises FLAG_REF
    plus TYPE_REF for qualname, and a module with a nested function that
    exercises ref sharing between a const tuple and its surrounding code
    object.
    
    * Accept CPython-tagged .pyc as read-only bytecode source
    
    SourceFileLoader.get_code now also looks for .pyc files using
    _RP_FALLBACK_CACHE_TAGS (currently ('cpython-314',)) in addition to
    sys.implementation.cache_tag. The matched .pyc is only used for
    reading; recompilation still writes to the RustPython-tagged path, so
    CPython's .pyc is never overwritten. Source-stat / hash / timestamp
    validation logic is unchanged.
    
    * Apply rustfmt to marshal helpers
    
    * Marshal PySlice from format version 4 instead of 5
    
    CPython's marshal supports TYPE_SLICE from format version 4 onwards
    and that is the default version. Rejecting slice dumps below version
    5 made marshal.dumps(slice(...)) fail with the default version and
    broke test.test_marshal.SliceTestCase.test_slice.
    
    * Revert "Accept CPython-tagged .pyc as read-only bytecode source"
    
    Lib/importlib/_bootstrap_external.py is CPython's own code copied
    verbatim; local patches here defeat compatibility tracking. The
    cpython-XX cache_tag fallback needs to live on the RustPython side
    (Rust code or sys.implementation.cache_tag policy), not as edits to
    the imported standard library.
    
    This reverts commit 1fc426d0fb5fcdb50d35cad13bbb43e8f6ce1c7f.
    
    * Format sys.implementation.cache_tag as cpython-{MAJOR}{MINOR}
    
    Use the CPython compatibility version (e.g. cpython-314) instead of
    the rustpython-{MAJOR_IMPL}_{MINOR_IMPL} interpreter version string.
    
    * Set marshal FORMAT_VERSION to 5 to match CPython 3.14.5
    
    Py_MARSHAL_VERSION is 5 in CPython 3.14.5 (Include/marshal.h:16) and
    TYPE_SLICE serialization rejects version < 5 (Python/marshal.c:720).
    Restore the same threshold and constant so marshal.version and the
    slice-marshal gate match CPython.
    
    * Thread marshal recursion depth through nested code objects
    
    Code objects embedded in const-tuples reset the depth budget on each
    recursion, so a hostile or pathological marshal stream of code-in-tuple-
    in-code can blow the stack despite MAX_MARSHAL_STACK_DEPTH. Pass the
    current depth through deserialize_code_inner and read_marshal_const_tuple
    and decrement at each code-object/tuple boundary.
    
    Also route dict keys through deserialize_value_after_header so TYPE_CODE
    keys decode instead of failing with BadType.
    youknowone authored May 24, 2026
    Configuration menu
    Copy the full SHA
    b5ff41c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d7d9365 View commit details
    Browse the repository at this point in the history
  5. Impl sys.audithook (RustPython#7960)

    * Update tests
    
    * Add basic audit support
    
    * Add audit for `time.sleep`
    
    * Add some for `socket`
    
    * Some syslog
    
    * Some sys related audits
    
    * some marshal
    
    * monitoring callback
    
    * Mark failing tests
    
    * clippy
    
    * Clippy
    
    * clippy
    
    * mark failing test
    
    * mark more
    
    * Update `test_sys_setprofile.py` to 3.14.5
    
    * Mark failing tests
    ShaharNaveh authored May 24, 2026
    Configuration menu
    Copy the full SHA
    2fabf38 View commit details
    Browse the repository at this point in the history
  6. Bump qs and express in /wasm/demo (RustPython#7959)

    Bumps [qs](https://github.com/ljharb/qs) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.
    
    Updates `qs` from 6.14.2 to 6.15.2
    - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
    - [Commits](ljharb/qs@v6.14.2...v6.15.2)
    
    Updates `express` from 4.22.1 to 4.22.2
    - [Release notes](https://github.com/expressjs/express/releases)
    - [Changelog](https://github.com/expressjs/express/blob/v4.22.2/History.md)
    - [Commits](expressjs/express@v4.22.1...v4.22.2)
    
    ---
    updated-dependencies:
    - dependency-name: express
      dependency-version: 4.22.2
      dependency-type: indirect
    - dependency-name: qs
      dependency-version: 6.15.2
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored May 24, 2026
    Configuration menu
    Copy the full SHA
    4389254 View commit details
    Browse the repository at this point in the history
  7. Add builtin.PythonFinalizationError (RustPython#7966)

    * Add PythonFinalizationError to builtins
    
    * Patch failing tests (unrelated)
    
    * Unmark passing test
    
    * Update `exception_hierarchy.txt` to 3.14.5
    ShaharNaveh authored May 24, 2026
    Configuration menu
    Copy the full SHA
    7011942 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    52305c0 View commit details
    Browse the repository at this point in the history
Loading