* Add host_env feature for sandbox isolation
Introduce a `host_env` feature flag that gates all host environment
access (filesystem, network, signals, processes). When disabled,
the VM operates in sandbox mode:
- _io module always available; FileIO gated by host_env
- SandboxStdio provides lightweight stdin/stdout/stderr via Rust std::io
- BytesIO/StringIO/BufferedIO/TextIOWrapper work without host_env
- open() returns UnsupportedOperation in sandbox
- stdlib modules (os, socket, signal, etc.) gated by host_env
- CI checks both host_env ON and OFF builds
* Auto-format: ruff check --select I --fix
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Rewrite faulthandler with live frame walking via
Frame.previous AtomicPtr chain and thread-local
CURRENT_FRAME (AtomicPtr) instead of frame snapshots
- Add signal-safe traceback dumping (dump_live_frames,
dump_frame_from_raw) walking the Frame.previous chain
- Add safe_truncate/dump_ascii for UTF-8 safe string
truncation in signal handlers
- Refactor write_thread_id to accept thread_id parameter
- Add SA_RESTART for user signal registration, SA_NODEFER
only when chaining
- Save/restore errno in faulthandler_user_signal
- Add signal re-entrancy guard in trigger_signals to
prevent recursive handler invocation
- Add thread frame tracking (push/pop/cleanup/reinit)
with force_unlock fallback for post-fork recovery
- Remove expectedFailure markers for now-passing tests
* gc module internal structure and API
Add gc_state module with GcState, GcGeneration, GcDebugFlags, GcStats.
Replace gc module stubs with working API backed by gc_state.
Add gc_callbacks and gc_garbage to Context.
Add is_gc_tracked, gc_finalized, gc_get_referents to PyObject.
Collection is stubbed (returns 0) — actual algorithm to follow.
* fix dict/weakref/generators
* unmark test_asyncio
* apply review
- Fix from_windows_err using new_exception_empty on OSError subclasses
(ConnectionRefusedError, ConnectionAbortedError), which caused segfault
in release builds due to debug_assert on type size mismatch
- Move ConnectPipe from instance method to module-level function
- Add Destructor for Overlapped to cancel pending I/O on object cleanup
- Add NMPWAIT_NOWAIT, NMPWAIT_USE_DEFAULT_WAIT, NMPWAIT_WAIT_FOREVER
constants to _winapi
New Features
Direct small-integer loading (0–255) and locals-loading for faster execution
Async-generator wrapping and improved generator resume behavior
Performance
Faster integer loads and streamlined jump/loop handling for better runtime performance
Bug Fixes
More robust StopIteration handling and stricter init return checks
Corrected iterator cleanup for async and sync loops
Improvements
Aligns loop and jump semantics with CPython 3.14 patterns
Remove pending_tls_output.clear() from Drop implementation.
SSLSocket._real_close() in Python doesn't call shutdown() before
closing - it just sets _sslobj = None. This means pending TLS data
in the output buffer may not have been flushed to the socket yet.
Clearing this buffer in Drop causes data loss, resulting in empty
HTTP responses (test_socketserver failure on Windows).
The explicit clearing is also unnecessary since all struct fields
are automatically freed when the struct is dropped.
Fix test_is_instance in CursorFactoryTests by properly handling the
factory argument in Connection.cursor() method. Now the factory can
be passed as both positional and keyword argument, and returns the
correct subclass type instead of always returning PyRef<Cursor>.
- Use FromArgs derive macro with CursorArgs struct for argument parsing
- Return PyObjectRef instead of PyRef<Cursor> to allow subclasses
- Use fast_issubclass to validate returned cursor is a Cursor subclass
- Properly differentiate between 'no argument' and 'None passed'
* Parse JSON in Rust
* Reuse key when decoding JSON
* Unmark resolved test
* Parse null/true/false directly in call_scan_once
Parse JSON constants (null, true, false) directly in Rust within
call_scan_once() instead of falling back to Python scan_once.
This reduces Python-Rust boundary crossings for array/object values.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Parse numbers directly in call_scan_once
Parse JSON numbers starting with digits (0-9) directly in Rust within
call_scan_once() by reusing the existing parse_number() method.
This reduces Python-Rust boundary crossings for array/object values.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Parse NaN/Infinity/-Infinity in call_scan_once
Parse special JSON constants (NaN, Infinity, -Infinity) and negative
numbers directly in Rust within call_scan_once(). This handles:
- 'N' -> NaN via parse_constant callback
- 'I' -> Infinity via parse_constant callback
- '-' -> -Infinity or negative numbers via parse_constant/parse_number
This reduces Python-Rust boundary crossings for array/object values.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Correct wrong index access
* Leave more flame span
* Refactor json scanstring with byte index
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>