Commit Graph
4478 Commits
Author SHA1 Message Date
Jeong, YunWon 6cf1d32f93 skip flaky weakref test (#7286) 2026-03-01 15:28:23 +09:00
Jeong, YunWon 1b89b8f793 instruction CACHE (#7251)
* Emit CACHE code units in bytecode to match CPython 3.14

- Add cache_entries() method to Instruction enum
- Emit CACHE code units after opcodes in finalize_code
- Handle NO_LOCATION (line=-1) in linetable for CACHE entries
- Account for CACHE entries in exception table generation
- Skip CACHE entries in VM execution loop (with jump detection)
- Handle CACHE in InstrumentedLine/InstrumentedInstruction/InstrumentedForIter/InstrumentedNotTaken
- Skip CACHE in monitoring instrumentation phases
- Update co_branches() for cache-adjusted offsets
- Restore _cache_format in Lib/opcode.py
- Remove expectedFailure from test_c_call, test_start_offset

* Use relative jump offsets and fix bytecode layout

- Convert jump arguments from absolute to relative offsets
  in frame.rs, monitoring.rs, and stack_analysis
- Add jump_relative_forward/backward helpers to ExecutingFrame
- Resolve pseudo jump instructions before offset fixpoint loop
- Emit NOP for break, continue, pass to match line-tracing
- Fix async for: emit EndAsyncFor with correct target, add NotTaken
- Fix comprehension if-cleanup to use separate block
- Fix super() source range for multi-line calls
- Fix NOP removal to preserve line-marker NOPs
- Fix InstrumentedLine cache skipping after re-dispatch
- Match InstrumentedResume/YieldValue in yield_from_target
- Remove CALL_FUNCTION_EX cache entry from opcode.py
- Remove resolved expectedFailure markers

* Align CPython 3.14 LOAD_GLOBAL null-bit and RERAISE semantics

* Remove redundant CPython-referencing comments

Clean up comments that unnecessarily mention CPython per project
convention. Replace with concise descriptions of the behavior itself.
2026-03-01 14:51:54 +09:00
Jeong, YunWon 562d2ca47a Merge pull request #7283 from youknowone/ssl
Update ssl from v3.14.3 and add _ssl.HAS_PHA
2026-03-01 14:49:08 +09:00
Jeong, YunWonandCPython Developers 8403e61b51 Update random from v3.14.3 and fix getrandbits (#7270)
* Update random from v3.14.3

* getrandbits and itertools.repeat now accept __index__ protocol.

---------

Co-authored-by: CPython Developers <>
2026-03-01 13:20:32 +09:00
Jeong, YunWon 6015e15c16 Implement trace/profile events and opcode tracing for generators (#7268)
- Add TraceEvent::Exception and Opcode variants with profile filtering
- Extract dispatch_traced_frame helper for Call/Return trace events
- Fire exception trace on new raises, SEND StopIteration, FOR_ITER StopIteration
- Fire opcode trace events gated by f_trace_opcodes
- Move prev_line to FrameState for persistence across generator suspend/resume
- Reset prev_line in gen_throw for correct LINE monitoring after yield
- Add per-code event mask (events_for_code) to prevent unrelated code instrumentation
- Remove expectedFailure markers from test_bdb (5) and test_sys_setprofile (14)
2026-03-01 13:18:37 +09:00
CPython Developers 2dcc116380 Update ssl from v3.14.3 2026-03-01 11:36:46 +09:00
fanninpm 7b8558b4cb Remove test_importlib from polluters (#7279) 2026-03-01 10:58:47 +09:00
Shahar Naveh 4e9c4f69ca Update test_set.py from 3.14.3 (#7282)
* Update `test_set.py` from 3.14.3

* Cleanup code a bit

* Mark failing tests
2026-03-01 10:58:23 +09:00
Jiseok CHOI 44b1ca01fa Fix _hashlib.compare_digest to reject non-ASCII strings (#7280)
Add non-ASCII string check to _hashlib.compare_digest, matching the
behavior of _operator._compare_digest. When both arguments are strings,
non-ASCII characters now correctly raise TypeError.

Also replace the non-constant-time == comparison with constant_time_eq
for proper timing-attack resistance, and return PyResult<bool> instead
of PyResult<PyObjectRef>.
2026-03-01 10:51:39 +09:00
Jiseok CHOI 828f960110 sqlite3: add Cursor.row_factory pygetset and fix Connection.cursor() propagation (#7278)
Add #[pygetset] getter/setter for Cursor.row_factory so that Python-level
attribute access reads/writes the Rust struct field instead of the
instance dict.

Fix Connection.cursor() to only propagate the connection's row_factory
to the cursor when the connection's row_factory is not None, matching
CPython behavior. Previously it unconditionally overwrote the cursor's
row_factory, discarding any factory set by a cursor subclass __init__.
2026-03-01 10:44:50 +09:00
Jiseok CHOI 62e1c11756 Handle reentrant detach in TextIOWrapper.close() (#7277)
When a custom `closed` property on the underlying buffer calls
`detach()` during the `file_closed()` check in `close()`, the
wrapper's internal buffer becomes None. Subsequent flush/close
operations then fail with AttributeError on NoneType.

Add a guard after the `file_closed()` check to detect if the buffer
was detached reentrantly, and return early in that case (detach has
already flushed the stream).

This mirrors the fix applied in CPython
(https://github.com/python/cpython/issues/142594\).
2026-03-01 10:44:13 +09:00
Shahar Naveh baa5214ecb Fix list.__repr__ deadlock (#7275)
* Fix list repr deadlock

* Unmark apssing test
2026-03-01 10:43:23 +09:00
ShaharNaveh 5396b9730d Mark failing tests 2026-03-01 10:42:37 +09:00
ShaharNaveh 041da5ba93 Update test_format.py from 3.14.3 2026-03-01 10:42:37 +09:00
ShaharNaveh e71bbf444d Update test_strtod.py 2026-03-01 10:42:37 +09:00
ShaharNaveh d43693d657 Update test_string_literals.py from 3.14.3 2026-03-01 10:42:37 +09:00
ShaharNaveh 0ffb1eeae7 Update test_str.py to 3.14.3 2026-03-01 10:42:37 +09:00
ShaharNaveh 0b379502e6 Update test_dynamic.py to 3.14.3 2026-03-01 10:39:06 +09:00
CPython Developers 548db88331 Update random from v3.14.3 2026-02-28 22:50:51 +09:00
Jeong, YunWon b882baa4ac Fix trace_event to return trace function result
- Return trace function's return value from trace_event()
  to support per-frame f_trace assignment
- Match CPython's trace_trampoline: set f_trace from call
  event return value, clear on error
- Fire return event only when frame is traced or profiled
- Remove expectedFailure from passing bdb/settrace tests
2026-02-28 12:09:59 +09:00
CPython Developers c0f9b5742d Update bdb from v3.14.3 2026-02-28 12:09:59 +09:00
Jiseok CHOI a6b06c80fd sqlite3: handle int type in Connection.timeout parameter (#7237) 2026-02-28 10:38:30 +09:00
Shahar Naveh 63dd6a6d9d Update subprocess.py to 3.14.3 (#7244) 2026-02-28 10:36:09 +09:00
Shahar Naveh 6addb91bf3 Update ruff to 0.15.4 (#7246)
* Update ruff to 0.15.4

* Unmark passing test
2026-02-27 22:59:41 +09:00
Jiseok CHOI 3f86af32f3 sqlite3: reject negative fetchmany values (#7240) 2026-02-27 21:03:40 +09:00
Jiseok CHOI 0d1e0d48e8 sqlite3: reject negative arraysize values (#7238) 2026-02-27 20:59:15 +09:00
Jeong, YunWon 9fe3ea750f Merge pull request #7223 from youknowone/tarfile
Update tarfile from v3.14.3 and fix bugs
2026-02-27 20:44:16 +09:00
Shahar Naveh a29bf44452 Update test_atexit.py to 3.14.3 (#7217) 2026-02-27 19:29:59 +09:00
ShaharNaveh 0d0ee81e69 Patch test_sax.py 2026-02-27 10:05:21 +01:00
ShaharNaveh 3c7f100e22 Mark failing tests at test_pyexpat.py 2026-02-27 09:58:46 +01:00
ShaharNaveh 87abdbd204 Mark failing tests on test_minidom.py 2026-02-27 09:55:31 +01:00
ShaharNaveh c6b6a722fa Patch test_xml_etree.py 2026-02-27 09:49:35 +01:00
ShaharNaveh 866a06b37d Update xml to 3.14.3 2026-02-27 09:44:41 +01:00
Jeong, YunWon 5eb061d809 xz2->liblzma and remove liblzma-sys 2026-02-27 17:39:12 +09:00
Jeong, YunWon 5f86ffd126 Unmark test_lzma 2026-02-27 16:53:55 +09:00
CPython Developers a620ae7941 Update tarfile from v3.14.3
Assisted-by: Codex:gpt-6
2026-02-27 16:53:55 +09:00
Shahar NavehandJeong, YunWon 1708a7d2c4 Update http from 3.14.3 (#7137)
* Update `http` from 3.14.3

* Reapply patch

* Update `test/certdata` from 3.14.3

* Revert "Update `test/certdata` from 3.14.3"

This reverts commit fa8fb388b3.

* Update `test_httpservers.py`

* Reapply long test patch

* Mark failing tests

* Skip flaky test

* Allow password to be None

* Unmark passing test

* Fix error message

* Clippy

---------

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-02-27 05:44:37 +00:00
Jeong, YunWon f54f226f84 Unmark successful tests
test_peepholer
test_bdb
2026-02-27 09:07:23 +09:00
Jeong, YunWon e123b9c073 set_f_lineno, set_f_lasti, PyAtomic refactor
- Implement set_f_lineno with stack analysis and deferred unwinding
- Add Frame::set_lasti() for trace callback line jumps
- Implement co_branches() on code objects
- Clear _cache_format in opcode.py (no inline caches)
- Fix getattro slot inheritance: preserve native slot from inherit_slots
- Fix BRANCH_RIGHT src_offset in InstrumentedPopJumpIf*
- Move lasti increment before line event for correct f_lineno
- Skip RESUME instruction from generating line events
- Defer stack pops via pending_stack_pops/pending_unwind_from_stack
  to avoid deadlock with state mutex
- Fix ForIter exhaust target in mark_stacks to skip END_FOR
- Prevent exception handler paths from overwriting normal-flow stacks
- Replace #[cfg(feature = "threading")] duplication with PyAtomic<T>
  from rustpython_common::atomic (Radium-based unified API)
- Remove expectedFailure from 31 now-passing jump tests
2026-02-27 09:07:23 +09:00
Jeong, YunWon ece2cc1c40 mark failing tests 2026-02-27 09:07:23 +09:00
CPython Developers d77c7f2519 Update test_compile from v3.14.3 2026-02-27 09:06:56 +09:00
Jeong, YunWon a059bd2958 impl sys.monitoring 2026-02-27 09:06:55 +09:00
Jeong, YunWon cf2b223c87 patch test_monitoring not to entirely skipped 2026-02-27 04:36:46 +09:00
CPython Developers 70942d3333 Update test_monitoring from CPython 3.14.3 2026-02-27 04:36:46 +09:00
Jeong, YunWon 7311b87c7b Remove PyStr::as_str, use as_wtf8/PyUtf8Str instead (#7218)
- Remove as_str() from PyStr/Py<PyStr> (was panicking on surrogates)
- Add Wtf8Concat trait and concat! macro for WTF-8 formatting
- Add impl From<&str> for &Wtf8 conversion
- Add AsPyStr/DictKey impls for PyUtf8Str types
- Migrate all call sites to as_wtf8(), to_str(), or PyUtf8Str
- Fix exception message APIs to accept Wtf8Buf
- Deduplicate inner-scope imports across modules
2026-02-27 04:20:11 +09:00
Jeong, YunWon 8df1a2b05d Clear frame locals and stack on generator close + Add dir_fd support for rmdir, remove/unlink, scandir (#7222)
* Clear frame locals and stack on generator close

Add Frame::clear_locals_and_stack() to release references held by
closed generators/coroutines, matching _PyFrame_ClearLocals behavior.
Call it from Coro::close() after marking the coroutine as closed.

Update test_generators.py expectedFailure markers accordingly.

* Add dir_fd support for rmdir, remove/unlink, scandir

- rmdir: use unlinkat(fd, path, AT_REMOVEDIR) when dir_fd given
- remove/unlink: use unlinkat(fd, path, 0) when dir_fd given
- scandir: accept fd via fdopendir, add ScandirIteratorFd
- listdir: rewrite fd path to use raw readdir instead of nix::dir::Dir
- DirEntry: add d_type and dir_fd fields for fd-based scandir
- Update supports_fd/supports_dir_fd entries accordingly

* cells_free
2026-02-27 01:58:33 +09:00
Shahar Naveh fbb65cc738 Update compileall.py to 3.14.3 (#7225) 2026-02-25 21:15:55 +09:00
CPython Developers 2abc1386c6 Update annotationlib from v3.14.3 2026-02-24 16:22:44 +09:00
CPython Developers e461a0a7b9 Update zipfile from v3.14.3 2026-02-24 14:23:19 +09:00
Jeong, YunWon 7aa38ebe9f Implement Windows SemLock in _multiprocessing module (#7199)
* Implement Windows SemLock in _multiprocessing module

Add SemLock class using Windows semaphore APIs (CreateSemaphoreW,
WaitForSingleObjectEx, ReleaseSemaphore) so test_multiprocessing
suites are no longer skipped with "lacks a functioning sem_open".
Also add sem_unlink as no-op and flags dict for Windows.

* Fix _multiprocessing recv to return bytes and improve SemLock reliability

- recv() now returns bytes instead of int (matching CPython)
- Remove spurious GetLastError() check after CreateSemaphoreW
- Add signal checking during blocking SemLock acquire

* Include winerror in OSError.__reduce__ on Windows

* Remove expectedFailure for tests now passing with Windows SemLock

* Fix OSError.__reduce__ to preserve winerror when filename is None

When filename is None, __reduce__ was reconstructing a 2-element
(errno, msg) tuple, dropping the winerror at position 3 in the
original args. Use the original args tuple instead, matching CPython.

* Validate maxvalue > 0 in SemLock and document winerror __reduce__ divergence

* Reject embedded null characters in mmap tagname and _winapi file mapping names
2026-02-24 10:12:29 +09:00