* Support csv quoting modes added in Python 3.12
Implement writer handling for QUOTE_STRINGS and QUOTE_NOTNULL so the exported constants no longer panic and follow CPython behavior for string, non-null, None, and quotechar validation cases.
Constraint: RustPython contribution policy requires CPython-compatible behavior through Rust-side changes and regression coverage outside Lib/.
Rejected: Marking CPython Lib tests or hiding the constants | would preserve a runtime panic for supported public constants.
Confidence: high
Scope-risk: narrow
Directive: Keep QUOTE_STRINGS and QUOTE_NOTNULL writer behavior aligned with CPython's csv module when extending dialect validation.
Tested: cargo check -p rustpython-stdlib; cargo run --release -- extra_tests/snippets/stdlib_csv.py; cargo run --release -- -m test test_csv; cargo clippy; pre-commit run --all-files via temporary venv/PATH shim; cargo test --workspace --exclude rustpython_wasm --exclude rustpython-venvlauncher -- --test-threads=1
Not-tested: Remote CI and PR creation were not run because remote git operations require explicit approval.
Assisted-by: Codex:gpt-5.5
* Update crates/stdlib/src/csv.rs
Co-authored-by: Shahar Naveh <50263213+ShaharNaveh@users.noreply.github.com>
* Update crates/stdlib/src/csv.rs
Co-authored-by: Shahar Naveh <50263213+ShaharNaveh@users.noreply.github.com>
* Keep csv writer follow-up lint clean
Apply maintainer-requested expression cleanups and rustfmt wrapping so the PR lint job can pass without changing behavior.
Constraint: GitHub Actions Lint failed on rustfmt output after the review suggestion.
Rejected: Changing csv writer semantics | the failing check was formatting-only and all behavior tests already passed.
Confidence: high
Scope-risk: narrow
Directive: Keep future review suggestions rustfmt-clean before pushing.
Tested: cargo fmt --check; cargo check -p rustpython-stdlib; cargo run --release -- extra_tests/snippets/stdlib_csv.py; cargo run --release -- -m test test_csv; cargo clippy; pre-commit run --all-files; cargo test --workspace --exclude rustpython_wasm --exclude rustpython-venvlauncher -- --test-threads=1
Not-tested: Remote CI has not rerun yet; this commit will trigger it after push.
Assisted-by: Codex:gpt-5.5
---------
Co-authored-by: Shahar Naveh <50263213+ShaharNaveh@users.noreply.github.com>
Python's `os.rename` supports renaming a path relative to a directory
descriptor - essentially, `renameat`. The syscall and its Rustix wrapper
does all of the work, so this patch mainly updates the Python signature
to forward to the implementation.
As of this patch, `os.rename` is still incorrect for Windows because it
always replaces the destination file. I added a small note for future
contributors (or myself, since I might tackle it) as a reminder of
what's broken.
Rustix bypasses `libc` to make direct syscalls on Linux. Rustix is also
semantically cleaner than `libc` itself. For `copy_file_range`, the
offsets can't be negative but `libc`'s `off_t` type is an `i64` because
it's used elsewhere, including for functions that CAN take a negative
offset. Rustix is cleaner because the offsets are `u64`.
* Add a dummy `posix._is_inputhook_installed` function
* Add a dummy `nt._is_inputhook_installed` function
* Update `_pyrepl` to 3.14.5
* Update `test_pyrepl` to 3.14.5
* Add a dummy `posix._is_inputhook_installed` function
Constraint: Python-level sentinel equality can re-enter the same callable iterator while internal iterator state is protected by a non-reentrant lock.
Rejected: Holding the callable iterator status lock across sentinel equality | user-defined __eq__ can call next() on the same iterator and deadlock.
Confidence: high
Scope-risk: moderate
Tested: pre-commit run --all-files; cargo test --workspace --exclude rustpython_wasm --exclude rustpython-venvlauncher; cargo build --release --features sqlite; pytest -v in extra_tests; cargo run --quiet -- extra_tests/snippets/protocol_iternext.py; cargo check -p rustpython-vm; cargo clippy -p rustpython-vm --all-targets -- -D warnings; git diff --check
Not-tested: push/PR creation
Assisted-by: Codex:gpt-5.5
* Align patches of `test_tty`
* Fix failing tests at `test_tty.py`
* Align patches of `test_termios.py`
* Unmark passing tests under `test_termios.py`
* Unmark another passing test
* Fix WASM memory allocation failure (#4989)
This commit addresses the unbounded memory allocation issue on WASM targets that caused minimal programs (like = 1) to fail with ~79MB allocation errors in constrained runtimes like wasmi.
The fixes include:
1. Capping the max memory limit at 64MB and restricting stack size to 1MB via linker flags in .cargo/config.toml.
2. Reducing the minimum chunk size of the DataStack from 16KB to 4KB on WASM targets to shrink the initial memory footprint.
3. Adding a wasm-release profile in the root Cargo.toml optimized for size with opt-level = s, LTO enabled, and symbols stripped.
* Trigger CI rerun
* Address review feedback: add comments, use cfg! for MIN_CHUNK_SIZE
* Remove duplicate MIN_CHUNK_SIZE definition
* Fix duplicate MIN_CHUNK_SIZE and format for prek lint
* Update CI to use wasm-release profile for WASM tests
* Remove leftover conflict markers
* Clean remaining conflict markers in CI workflow
* Clean remaining conflict markers in CI workflow
* Trigger CI to pick up new required check
* Remove --max-memory flag, keep stack limit only
Redo of #7800.
Bumping the random and crypto crates is not trivial. Both sets of crates
have had API changes which require manual updates.
AI use:
I wrote all of the code myself but used AI to figure out the new APIs.
AI explained SHAKE's block size and why the block_size() function
doesn't exist in the new crate. I confirmed the block size, which is
actually represented in the new types for SHAKE. `Shake128` is actually
`Shake<168>` - 168 is the block size. I cited Wikipedia as it lists the
SHAKE block size in bits.
I also used AI to figure out HMAC for SHA3.
Assisted-by: Codex:gpt-5.4