Commit Graph

10255 Commits

Author SHA1 Message Date
Mark Shannon 879c85f6e4 GH-145667: Merge GET_ITER and GET_YIELD_FROM_ITER (GH-146120)
* Merge GET_ITER and GET_YIELD_FROM_ITER. Modify SEND to make it a bit more like FOR_ITER
2026-03-21 10:48:13 +00:00
Ken Jin acfb4528de gh-146099: Optimize _GUARD_CODE_VERSION+IP via function version symbols (GH-146101) 2026-03-20 12:26:41 +00:00
Mingzhu Yan 98977ca433 gh-131798: JIT: optimize _LOAD_COMMON_CONSTANT (GH-146104) 2026-03-20 05:55:22 +08:00
Sacul 0d37e423d5 gh-145866: Convert SET_UPDATE to leave its inputs on the stack to be cleaned up by _POP_TOP (GH-145979) 2026-03-19 19:17:58 +08:00
Victor Stinner e1e4852133 gh-146092: Handle _PyFrame_GetFrameObject() failures properly (#146124)
* Fix _PyFrame_GetLocals() and _PyFrame_GetLocals() error handling.
* _PyEval_ExceptionGroupMatch() now fails on _PyFrame_GetLocals()
  error.
2026-03-18 18:27:52 +01:00
Hai Zhu 6fe91a9e80 gh-144888: JIT executor bloom filter wide-type optimization and function Inlining (GH-146114) 2026-03-19 00:58:14 +08:00
Victor Stinner 1e4ed93210 gh-146092: Fix error handling in _BINARY_OP_ADD_UNICODE opcode (#146117)
Fix also error handling in _BINARY_OP_ADD_FLOAT,
_BINARY_OP_SUBTRACT_FLOAT and _BINARY_OP_MULTIPLY_FLOAT opcodes.
PyStackRef_FromPyObjectSteal() must not be called with a NULL
pointer.
2026-03-18 17:23:05 +01:00
Sam Gross e0f7c1097e gh-145779: Improve classmethod/staticmethod scaling in free-threaded build (#145826)
Add special cases for classmethod and staticmethod descriptors in
_PyObject_GetMethodStackRef() to avoid calling tp_descr_get, which
avoids reference count contention on the bound method and underlying
callable. This improves scaling when calling classmethods and
staticmethods from multiple threads.

Also refactor method_vectorcall in classobject.c into a new _PyObject_VectorcallPrepend() helper so that it can be used by
PyObject_VectorcallMethod as well.
2026-03-17 14:24:44 -04:00
Ken Jin 966fc81531 gh-146058: Fix _GUARD_CODE_VERSION_* (GH-146060) 2026-03-18 01:19:44 +08:00
Sacul 1efd9939c8 gh-131798: Optimize _ITER_CHECK_RANGE and _ITER_CHECK_LIST in the JIT (GH-144583) 2026-03-17 22:07:17 +08:00
Ken Jin 3d0824aef2 gh-127958: Trace from RESUME in the JIT (GH-145905) 2026-03-17 00:18:59 +08:00
Hai Zhu 81ef1b7317 gh-144888: Replace bloom filter linked lists with continuous arrays to optimize executor invalidating performance (GH-145873) 2026-03-16 15:58:18 +00:00
Ken Jin 182aea2f57 gh-146018: Disable over-aggressive optimization for _GUARD_CODE_VERSION (GH-145923) 2026-03-16 13:52:56 +00:00
Sacul 37121ef77e gh-145866: Convert CALL_INTRINSIC_1 to leave its inputs on the stack to be cleaned up by _POP_TOP. (GH-145964) 2026-03-16 11:58:12 +00:00
Gregory P. Smith 83edae33a5 gh-145990: sort --help-env sections by environment variable name (GH-145997)
* sort --help-env alphabetically by name.
* add a sorting regression test in test_help_env.
2026-03-15 15:22:57 -07:00
Gregory P. Smith b062f391cf gh-145990: Sort python --help-xoptions by option name (GH-145991)
* Sort --help-xoptions alphabetically by name.
* add a sorting regression test in test_help_xoptions
2026-03-15 22:02:14 +00:00
Gregory P. Smith 4a71946b8f gh-122575: gh-142349: fix sys.flags tuple size (it unintentionally increased) (GH-145988)
the lazy imports PEP initial implementation (3.15 alpha) inadvertently incremented the length of the sys.flags tuple. In a way that did not do anything useful or related to the lazy imports setting (it exposed sys.flags.gil in the tuple). This fixes that to hard code the length to the 3.13 & 3.14 released length of 18 and have our tests and code comments make it clear that we've since stopped making new sys.flags attributes available via sequence index.
2026-03-15 20:30:01 +00:00
Sacul 798070d8ca gh-134584: Eliminate redundant refcounting in JIT for MATCH_CLASS (GH-144821) 2026-03-14 12:00:18 +00:00
VanshAgarwal24036 59d97683c1 gh-145792: Fix incorrect alloca allocation size in traceback.c (#145814) 2026-03-13 13:15:26 +01:00
Mark Shannon 453562a467 GH-145692: Convert DEOPT_IFs to EXIT_IFs (GH-145751)
* Convert DEOPT_IFs to EXIT_IFs for guards. Keep DEOPT_IF for intentional drops to the interpreter.

* Modify BINARY_OP_SUBSCR_LIST_INT and STORE_SUBSCR_LIST_INT to handle negative indices, to keep EXIT_IFs and DEOPT_IFs in different uops
2026-03-12 10:57:59 +00:00
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