Commit graph

10139 commits

Author SHA1 Message Date
AN Long
54bedcf714
gh-144012: Check null binary op extend (#144014) 2026-01-19 02:38:37 +08:00
Hai Zhu
b4b73245d8
gh-143421: Use new buffer to save optimized uops (GH-143682) 2026-01-17 15:52:16 +00:00
Hai Zhu
61ec66acd5
gh-143946: Show JitOptSymbol on abstract stack when set PYTHON_OPT_DEBUG > 4 (GH-143957) 2026-01-17 15:20:35 +00:00
Neil Schemenauer
bb25f7280a
gh-132657: Add maybe_enable_deferred_ref_count() (gh-142843)
If we are specializing to `LOAD_GLOBAL_MODULE` or `LOAD_ATTR_MODULE`, try
to enable deferred reference counting for the value, if the object is owned by
a different thread.  This applies to the free-threaded build only and should
improve scaling of multi-threaded programs.
2026-01-17 01:54:43 +00:00
Dino Viehland
4d5a676aa0
gh-142913: Add test case for interpreter generator w/ overridden opcodes (#142911)
Add test case for interpreter generator w/ overridden opcodes
2026-01-16 10:33:29 -08:00
Peter Bierma
19e64afddf
gh-141070: Rename PyUnstable_Object_Dump to PyObject_Dump (GH-142848) 2026-01-16 09:19:43 -05:00
Mark Shannon
ae53da5758
GH-143493: Conform to spec for generator expressions while supporting virtual iterators (GH-143569)
* Moves the `GET_ITER` instruction into the generator function preamble.
  This means the the iterable is converted into an iterator during generator
  creation, as documented, but keeps it in the same code object allowing
  optimization.
2026-01-16 09:11:58 +00:00
Peter Gessler
f5685a266b
gh-80620: Support negative timestamps on windows in time.gmtime, time.localtime, and datetime module (#143463)
Previously, negative timestamps (representing dates before 1970-01-01) were
not supported on Windows due to platform limitations. The changes introduce a
fallback implementation using the Windows FILETIME API, allowing negative
timestamps to be correctly handled in both UTC and local time conversions.
Additionally, related test code is updated to remove Windows-specific skips
and error handling, ensuring consistent behavior across platforms.

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-15 10:51:11 +01:00
Donghee Na
794f758cd8
gh-141504: Refactor policy object into a single opt_config (gh-143644) 2026-01-15 09:53:00 +09:00
Mohammad Miadh Angkad
499706b843
GH-143842: Make optimizer color table static (GH-143846) 2026-01-14 20:37:13 +00:00
Ken Jin
e370c8db52
gh-143123: Protect against recursive tracer calls/finalization (GH-143126)
* Stronger check for recursive traces

* Add a stop_tracing field

* Stop early when tracing exceptions
2026-01-14 12:23:14 +00:00
Mark Shannon
6db952eae9
GH-143613: Add colours and some more edges to executor visualization graph (GH-143809) 2026-01-14 11:34:58 +00:00
Duane Griffin
ce8f5f98c6
gh-106287: Do not write objects after an unmarshalling error (GH-132715)
Writing out an object may involve a slot lookup, which is not safe to do with
an exception raised. In debug mode an assertion failure will occur if this
happens.
2026-01-14 11:25:46 +00:00
Hai Zhu
94dbce1397
gh-138050: Use cold flag instead of warm flag in MAKE_WARM (GH-143827) 2026-01-14 10:27:33 +00:00
Ken Jin
2873c31edf
gh-131798: JIT optimizer: Support custom binary op and property frames (GH-143735) 2026-01-13 19:11:53 +00:00
reiden
c556786b8b
gh-134584: Eliminate redundant refcounting in TO_BOOL_INT, TO_BOOL_LIST (GH-143759) 2026-01-12 21:56:26 +00:00
Nadeshiko Manju
e535bdb0a2
gh-134584: Eliminate redundant refcounting from _CONTAINS_{OP|OP_SET|OP_DICT} (GH-143731)
Signed-off-by: Manjusaka <me@manjusaka.me>
2026-01-12 15:47:31 +00:00
Cajetan Rodrigues
054a565c64
gh-134584: JIT: Remove redundant refcount for _BINARY_OP_SUBSCR_DICT (GH-143724) 2026-01-12 14:13:55 +00:00
Ken Jin
548526bbbe
gh-134584: JIT: Remove redundant refcounting for UNARY_{INVERT|NEGATIVE} (GH-143704) 2026-01-11 20:42:55 +00:00
Bénédikt Tran
ce6bae92da
gh-143377: fix crashes in _interpreters.capture_exception (#143418) 2026-01-10 12:37:54 +01:00
Nadeshiko Manju
e2f0160026
gh-143604: Hold strong reference to executor during JIT tracing (GH-143646)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2026-01-10 11:15:48 +00:00
Ken Jin
95259116ec
gh-142764: Restore REPLACE_OPCODE_IF_EVALUATES_PURE optimization for some ops (GH-143335) 2026-01-09 23:18:22 +00:00
Ken Jin
e0fb278064
gh-143421: Allocate all JIT state in one go (GH-143626) 2026-01-09 19:00:49 +00:00
Ken Jin
b852236b26
gh-143421: Lazily allocate tracer code and opt buffers (GH-143597) 2026-01-09 16:56:19 +00:00
A.Ibrahim
a4086d7f89
gh-142829: Fix use-after-free in Context.__eq__ via re-entrant ContextVar.set (#142905) 2026-01-09 17:57:34 +05:30
Victor Stinner
39a2bcf949
gh-143547: Fix PyErr_FormatUnraisable() fallback (#143557)
Hold a strong reference to 'hook' while calling the default
unraisable took to log hook failure.

Fix test_sys.UnraisableHookTest: use the right decorator function to
disable colors. Previously, tests were always skipped.
2026-01-09 13:16:22 +01:00
Hai Zhu
aeb3403563
gh-143421: Move JitOptContext from stack allocation to per-thread heap allocation (GH-143536)
* move JitOptContext to _PyThreadStateImpl
* make _PyUOpInstruction buffer a part of _PyThreadStateImpl

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-01-08 19:38:21 +00:00
Sam Gross
8cf5c4d89a
gh-142908: Don't use DK_IS_UNICODE in interpreter (gh-142909)
`DK_IS_UNICODE()` includes split keys and we don't want to specialize on
those accesses..
2026-01-08 09:32:20 -05:00
Sam Gross
f11f5ebfe6
gh-129824: Fix data race on runtime->gilstate.check_enabled (gh-143530) 2026-01-07 17:56:14 -05:00
Dino Viehland
bfc3d8d77f
gh-143531: Use macro to check if PEP 523 is hooked (#143532)
Use macro to check if PEP 523 is hooked
2026-01-07 13:26:19 -08:00
Nadeshiko Manju
0a5c04a5ce
gh-134584: Eliminate redundant refcounting from TO_BOOL_STR (GH-143417)
Signed-off-by: Manjusaka <me@manjusaka.me>
2026-01-06 21:11:53 +00:00
Ken Jin
df355348f0
gh-142982: Specialize CALL_FUNCTION_EX (GH-143391) 2026-01-06 20:34:08 +00:00
Kumar Aditya
74bb3ca1f8
gh-142863: optimize list and set calls with generator expressions (#142864) 2026-01-06 23:23:28 +05:30
Ken Jin
90c44bc803
gh-131798: Support generator frames in the JIT optimizer (GH-143340) 2026-01-06 16:39:57 +00:00
Kumar Aditya
faa3dc7c64
gh-143469: enable LOAD_ATTR_MODULE specialization even if __getattr__ is defined (#143470) 2026-01-06 22:09:18 +05:30
reiden
54f1ed0299
gh-134584: Eliminate redundant refcounting in TO_BOOL_ALWAYS_TRUE (GH-143427)
Co-authored-by: Ken Jin <kenjin@python.org>
2026-01-06 16:11:56 +00:00
Sam Gross
841b7482dd
gh-143424: Fix assertion in _PyMutex_LockTimed (gh-143439)
The assertion doesn't necessarily hold for `threading.Lock`, so allow
the lock to be unlocked if `_PY_LOCK_PYTHONLOCK` is set on the flags.
2026-01-06 09:40:14 -05:00
Serhiy Storchaka
4d21297d28
gh-41779: Allow defining any __slots__ for a class derived from tuple (GH-141763) 2026-01-06 11:36:00 +02:00
Kumar Aditya
d6f77e6a3f
gh-116738: make entering of contextvars.Context thread safe (#143074) 2026-01-06 12:24:02 +05:30
Sam Gross
7a572d9f21
gh-143108: Don't instrument some faulthandler related functions for TSan (#143450) 2026-01-05 22:13:29 +01:00
Chris Eibl
e6bfe4d886
gh-139757: Add BINARY_OP_SUBSCR_USTR_INT (GH-143389) 2026-01-04 14:14:27 +00:00
Ken Jin
6116d70bbd
gh-143403: Fix a UAF in _BINARY_OP_INPLACE_ADD_UNICODE (GH-143404)
Fix a UAF in `_BINARY_OP_INPLACE_ADD_UNICODE`
2026-01-04 13:10:39 +00:00
Donghee Na
12283f6373
gh-141504: Factor out tracing and optimization heuristics into a single object (gh-143381) 2026-01-03 15:22:14 +00:00
Bartosz Sławecki
6d05e55de0
Fix dunder name typo in compiler code comment (#143374) 2026-01-03 10:08:42 +00:00
Aaron Wieczorek
b538c2832d
gh-143361: Pass PY_VECTORCALL_ARGUMENTS_OFFSET in _Py_CallBuiltinClass_StackRefSteal (GH-143367)
Co-authored-by: Aaron Wieczorek <woz@Aarons-MacBook-Pro.local>
2026-01-02 20:43:00 +00:00
Ken Jin
f7a03bb944
gh-134584: JIT: Remove redundant refcount from STORE_FAST (GH-143336) 2026-01-02 18:22:21 +00:00
Donghee Na
61f2ad9a3a
gh-139757: Fix unintended bytecode specialization for non-ascii string (gh-143352) 2026-01-02 14:05:08 +00:00
Donghee Na
315f474d11
gh-139757: Add _GUARD_NOS_COMPACT_ASCII for compact ascii optimization (gh-143332) 2026-01-02 20:58:14 +09:00
Nadeshiko Manju
d00d39f58e
gh-134584: Eliminate redundant refcounting from _LOAD_ATTR_SLOT (GH-143320)
Signed-off-by: Manjusaka <me@manjusaka.me>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2026-01-01 17:27:02 +00:00
Donghee Na
1fb8e0eb51
gh-134584: Eliminate redundant refcounting from _CALL{_BUILTIN_O, _METHOD_DESCRIPTOR_O} (GH-143330)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2026-01-01 17:25:38 +00:00