Commit Graph

10235 Commits

Author SHA1 Message Date
Sergey Miryanov d19de375a2 GH-145247: Use _PyTuple_FromPair in Parser and Python (#145842)
Use _PyTuple_FromPair in Parser and Python
2026-03-11 21:08:18 +00:00
Hai Zhu f062014d38 gh-144540: Add _MAKE_HEAP_SAFE uop to eliminate unnecessary refcount operations in RETURN_VALUE and YIELD_VALUE (GH-144414) 2026-03-11 20:24:19 +00:00
T. Wouters 706fd4ec08 gh-142183: Cache one datachunk per tstate to prevent alloc/dealloc thrashing (#145789)
Cache one datachunk per tstate to prevent alloc/dealloc thrashing when repeatedly hitting the same call depth at exactly the wrong boundary.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-11 15:46:16 +01:00
Sergey B Kirpichev dae85c4d93 gh-145633: Remove support for ancient ARM platforms with mixed-endian doubles (#145634)
* Drop DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 macro.
* Use DOUBLE_IS_BIG/LITTLE_ENDIAN_IEEE754 to detect endianness of
  float/doubles.
* Drop "unknown_format" code path in PyFloat_Pack/Unpack*().

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-11 12:39:24 +01:00
Pieter Eendebak 3f7141dac9 gh-145376: Fix refleaks and double decref for code in Python/ (#145666) 2026-03-10 10:46:13 +01:00
Hugo van Kemenade 170d85a37d gh-145731: Fix negative timestamp during DST on Windows (GH-145728) 2026-03-10 09:45:07 +01:00
Hai Zhu 66eafc9ea7 gh-144681: Fix JIT trace builder assertion failure when conditional branch jump target coincides with fallthrough target (GH-144742) 2026-03-10 12:12:48 +08:00
Stan Ulbrych 63eaaf9599 gh-145701: Fix __classdict__ & __conditional_annotations__ in class-scope inlined comprehensions (GH-145702) 2026-03-09 12:56:41 -07:00
Petr Viktorin 07a39ca07e gh-145278: Revert "freeze encodings (partially) and linecache (#145279)" (#145689) 2026-03-09 18:18:14 +00:00
Stan Ulbrych 255e79fa95 gh-143055: Fix crash in AST unparser when unparsing dict comprehension unpacking (#145556) 2026-03-09 10:37:23 -07:00
Mark Shannon 27c49707df GH-144688: Fix refleaks in JIT when optimization fails (GH-145420) 2026-03-09 15:21:33 +00:00
Filipe Laíns 3a0c716ad4 GH-145278: freeze encodings (partially) and linecache (#145279) 2026-03-09 13:28:00 +00:00
Victor Stinner 9159287f58 gh-144175: Add PyArg_ParseArray() function (#144283)
Add PyArg_ParseArray() and PyArg_ParseArrayAndKeywords()
functions to parse arguments of functions using the METH_FASTCALL
calling convention.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-06 21:57:44 +00:00
Victor Stinner 4fce98a920 gh-141510: Change marshal version to 6 (#145551)
Fix SliceTestCase: test also that version 4 fails with ValueError.
2026-03-06 10:23:11 +01:00
Victor Stinner c0ecf211b2 gh-145055: Accept frozendict for globals in exec() and eval() (#145072) 2026-03-05 12:35:43 +01:00
Victor Stinner 31343cf2bc gh-142417: Restore private _Py_InitializeMain() function (#145472)
This reverts commit 07c3518ffb.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-03-04 11:00:08 +01:00
Jelle Zijlstra bd13cc09fa gh-145376: Fix various reference leaks (GH-145377) 2026-03-03 16:23:30 +01:00
Donghee Na 6908372fb8 gh-145214: Narrow _GUARD_TOS_ANY_{SET,DICT} by using probable type (gh-145215) 2026-03-03 09:58:38 +09:00
Filipe Laíns eb611a8515 GH-145275: add -X pathconfig_warnings and PYTHON_PATHCONFIG_WARNINGS (#145277) 2026-03-02 19:19:05 +00:00
Hai Zhu 107863ee17 gh-144569: Avoid creating temporary objects in BINARY_SLICE for list, tuple, and unicode (GH-144590)
* Scalar replacement of BINARY_SLICE for list, tuple, and unicode
2026-03-02 17:02:38 +00:00
Bartosz Sławecki 8bcb3eaa67 gh-144851: Fix __lazy_import__ crash with user-defined filters (#144852) 2026-03-02 12:01:32 +01:00
Petr Viktorin 3b276f3f59 gh-144748: Make PyErr_CheckSignals raise the exception scheduled by PyThreadState_SetAsyncExc (GH-145178)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-03-02 11:47:32 +01:00
Taegyun Kim c2d3d6b0dd gh-144316: Fix missing exception in _remote_debugging with debug=False (#144442) 2026-02-26 21:14:34 +00:00
Hood Chatham 43fdb7037e gh-145037: Fix Emscripten trampoline with emcc >= 4.0.19 (#145038)
This undoes a change made as a part of PR 137470, for compatibility with EMSDK
4.0.19. It adds `emscripten_trampoline` field in `pycore_runtime_structs.h`
and initializes it from JS initialization code with the wasm-gc based trampoline
if possible. Otherwise we fall back to the JS trampoline.
2026-02-26 06:21:05 +08:00
Hai Zhu 277a03711b gh-145197: Fix JIT trace crash when recording function from cleared generator frame (GH-145220) 2026-02-25 16:52:53 +00:00
Stan Ulbrych 5e61a16c10 gh-145187: Fix crash on invalid type parameter bound expression in conditional block (GH-145188)
Fix parsing crash found by oss-fuzz
2026-02-24 12:44:57 -08:00
Donghee Na 0f759f1171 gh-145122: Add _GUARD_NOS_ANY_DICT to prevent STORE_SUBSCR_DICT on frozendict (gh-145039) 2026-02-25 00:48:45 +09:00
Gregory P. Smith ad4ee7cb0f gh-144015: Add portable SIMD optimization for bytes.hex() et. al. (GH-143991)
Add SIMD optimization for `bytes.hex()`, `bytearray.hex()`, and `binascii.hexlify()` as well as `hashlib` `.hexdigest()` methods using platform-agnostic GCC/Clang vector extensions that compile to native SIMD instructions on our [PEP-11 Tier 1 Linux and macOS](https://peps.python.org/pep-0011/#tier-1) platforms.

- 1.1-3x faster for common small data (16-64 bytes, covering md5 through sha512 digest sizes)
- Up to 11x faster for large data (1KB+)
- Retains the existing scalar code for short inputs (<16 bytes) or platforms lacking SIMD instructions, no observable performance regressions there.

## Supported platforms:

- x86-64: the compiler generates SSE2 - always available, no flags or CPU feature checks needed
- ARM64: NEON is always available, always available, no flags or CPU feature checks needed
- ARM32: Requires NEON support and that appropriate compiler flags enable that (e.g., `-march=native` on a Raspberry Pi 3+) - while we _could_ use runtime detection to allow neon when compiled without a recent enough `-march=` flag (`cortex-a53` and later IIRC), there are diminishing returns in doing so. Anyone using 32-bit ARM in a situation where performance matters will already be compiling with such flags. (as opposed to 32-bit Raspbian compilation that defaults to aiming primarily for compatibility with rpi1&0 armv6 arch=armhf which lacks neon)
- Windows/MSVC: Not supported. MSVC lacks `__builtin_shufflevector`, so the existing scalar path is used. Leaving it as an opportunity for the future for someone to figure out how to express the intent to that compiler.

This is compile time detection of features that are always available on the target architectures. No need for runtime feature inspection.
2026-02-22 19:19:03 -08:00
Hai Zhu fd01372d4e gh-145064: Fix JIT assertion failure during CALL_ALLOC_AND_ENTER_INIT side exit (GH-145100) 2026-02-22 18:46:03 +00:00
Chris Eibl 5944a539b9 Fix warnings on main (GH-145104) 2026-02-22 19:02:15 +08:00
Rudi Heitbaum faea32b729 gh-145092: Fix compiler warning for memchr() and wcschr() returning const pointer (GH-145093) 2026-02-22 10:01:27 +02:00
Victor Stinner 2be2dd5fc2 gh-145076: Check globals type in __lazy_import__() (#145086) 2026-02-21 22:06:59 +01:00
Stan Ulbrych e1bd0cd37b gh-145058: Add input validation to _PyImport_LazyImportModuleLevelObject (#145068) 2026-02-21 12:52:40 +00:00
Bénédikt Tran 34f4fa8425 gh-141226: Deprecate PEP-456 support for embedders (#141287)
Deprecate PEP-456 [1] support for providing an external definition
of the string hashing scheme. Removal is scheduled for Python 3.19.

Previously, embedders could define the ``Py_HASH_ALGORITHM`` macro to be
``Py_HASH_EXTERNAL`` [2] to indicate that the hashing scheme was provided
externally but this feature was undocumented, untested and most likely
unused.

[1]: https://peps.python.org/pep-0456/
[2]: https://peps.python.org/pep-0456/#hash-function-selection
2026-02-21 12:42:13 +01:00
Alper a56532771a gh-144981: Make PyUnstable_Code_SetExtra/GetExtra thread-safe (#144980)
* Make PyUnstable_Code_SetExtra/GetExtra thread-safe
2026-02-20 10:52:18 -08:00
Chris Eibl b5c8e6e133 gh-100239: Use `PyFloat_AS_DOUBLE and _PyLong_IsZero`` in the float / compactlong specializations (#144826) 2026-02-19 21:45:59 +02:00
David Peter 1d099164bc gh-144702: Use standard terminology in class pattern error message (#144703) 2026-02-19 13:31:13 +00:00
Mark Shannon 3f37b94c73 GH-144651: Optimize the new uops added when recording values during tracing. (GH-144948)
* Handle dependencies in the optimizer, not the tracer
* Strengthen some checks to avoid relying on optimizer for correctness
2026-02-19 11:52:57 +00:00
Donghee Na 3e2f5c133f gh-141510: Update specializer to support frozendict (gh-144949) 2026-02-19 01:10:53 +09:00
Victor Stinner 83f4fffe3d gh-144763: Don't detach the GIL in tracemalloc (#144779)
tracemalloc no longer detaches the GIL to acquire its internal lock.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-02-18 15:57:48 +00:00
Sam Gross 6577d870b0 gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554)
Align the QSBR thread state array to a 64-byte cache line boundary
and add padding at the end of _PyThreadStateImpl. Depending on heap
layout, the QSBR array could end up sharing a cache line with a
thread's tlbc_index, causing QSBR quiescent state updates to contend
with reads of tlbc_index in RESUME_CHECK. This is sensitive to
earlier allocations during interpreter init and can appear or
disappear with seemingly unrelated changes.

Either change alone is sufficient to fix the specific issue, but both
are worthwhile to avoid similar problems in the future.
2026-02-17 11:12:25 -05:00
Victor Stinner 696cdfc0a2 gh-141510, PEP 814: Add built-in frozendict type (#144757)
Add TYPE_FROZENDICT to the marshal module.

Add C API functions:

* PyAnyDict_Check()
* PyAnyDict_CheckExact()
* PyFrozenDict_Check()
* PyFrozenDict_CheckExact()
* PyFrozenDict_New()

Add PyFrozenDict_Type C type.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Adam Johnson <me@adamj.eu>
Co-authored-by: Benedikt Johannes <benedikt.johannes.hofer@gmail.com>
2026-02-17 10:54:41 +01:00
Benedikt Johannes 645f5c4a73 gh-144822: remove redundant decref in codegen.c (#144823) 2026-02-14 19:20:33 +00:00
Chris Eibl caac966b00 fix warnings in jit builds (GH-144817) 2026-02-14 17:39:10 +00:00
Chris Eibl 14cbd0e6af remove unused _PyFunction_LookupByVersion (GH-144814) 2026-02-14 14:09:01 +00:00
Yilei 5922149a50 gh-144766: Fix a crash in fork child process when perf support is enabled. (#144795) 2026-02-14 11:41:28 +00:00
Marc Mueller 75d4839fa9 gh-138912: Improve MATCH_CLASS opcode performance (GH-138915)
Only check for duplicates if there is at least one positional pattern.
With a test case for duplicate keyword attributes.
2026-02-13 21:06:15 -08:00
Pablo Galindo Salgado 072cd7c336 gh-142349: Fix refcount corruption in lazy import specialization (#144733)
Remove spurious Py_DECREF on borrowed ref in LOAD_GLOBAL specialization

_PyDict_LookupIndexAndValue() returns a borrowed reference via
_Py_dict_lookup(), but specialize_load_global_lock_held() called
Py_DECREF(value) on it when bailing out for lazy imports. Each time
the adaptive counter fired while a lazy import was still in globals,
this stole one reference from the dict's object. With 8+ threads
racing through LOAD_GLOBAL during concurrent lazy import resolution,
enough triggers accumulated to drive the refcount to zero while the
dict and other threads still referenced the object, causing
use-after-free.
2026-02-12 11:45:28 +00:00
Pablo Galindo Salgado 46d5106cfa gh-142349: Implement PEP 810 - Explicit lazy imports (#142351)
Co-authored-by: T. Wouters <twouters@meta.com >
Co-authored-by: Brittany Reynoso <breynoso@meta.com>
Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2026-02-12 00:15:33 +00:00
Sacul 6c8ca1c378 gh-134584: Optimize _BINARY_OP_SUBSCR_LIST_SLICE (GH-144659) 2026-02-10 22:33:32 +08:00