cpython/Include/internal
Pablo Galindo Salgado 65fbec64f6
[3.15] gh-151613: Fix remote debugging frame cache ABA (#152448)
gh-151613: Fix remote debugging frame cache ABA (#151614)

The remote debugging frame cache previously used only the last_profiled_frame address as its cache anchor. If a frame returned and a later frame reused the same _PyInterpreterFrame address, the profiler could accept a stale cache entry and splice parent frames from a different call chain into the current stack.

This adds a last_profiled_frame_seq counter next to last_profiled_frame, increments it when the anchor advances, stores it in frame cache entries, and validates cache hits against both the frame address and the sequence. Cache miss walks now copy stack chunks before storing new cache entries so stored continuations come from a stable snapshot. The new regression test exercises alternating call chains and checks that cached stacks never contain frames from both branches.

(cherry picked from commit 8cda6ae2f1)
2026-06-27 17:42:31 +00:00
..
mimalloc gh-144490: Fix mimalloc debug build for C++ (#144620) 2026-02-10 11:56:52 +01:00
pycore_abstract.h GH-143732: SEND specialization (GH-148963) 2026-05-05 15:19:16 +01:00
pycore_asdl.h gh-87347: Add parenthesis around macro arguments (#93915) 2022-06-20 16:04:52 +02:00
pycore_ast.h gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
pycore_ast_state.h gh-116021: Deprecate support for instantiating abstract AST nodes (#137865) 2026-05-02 09:50:06 -07:00
pycore_atexit.h gh-131238: Remove pycore_lock.h includes (#131483) 2025-03-19 23:46:25 +00:00
pycore_audit.h gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
pycore_backoff.h gh-127958: Trace from RESUME in the JIT (GH-145905) 2026-03-17 00:18:59 +08:00
pycore_bitutils.h gh-108216: Cleanup #include in internal header files (#108228) 2023-08-21 18:05:59 +00:00
pycore_blocks_output_buffer.h gh-148688: Fix _BlocksOutputBuffer_Finish() double free (#148689) 2026-04-18 09:56:56 +00:00
pycore_brc.h gh-131238: Remove pycore_lock.h includes (#131483) 2025-03-19 23:46:25 +00:00
pycore_bytes_methods.h gh-71679: Share the repr implementation between bytes and bytearray (GH-138181) 2025-09-17 11:10:29 +03:00
pycore_bytesobject.h gh-100239: Specialize more binary operations using BINARY_OP_EXTEND (GH-128956) 2026-04-16 09:22:41 +01:00
pycore_c_array.h gh-130080: move _Py_EnsureArrayLargeEnough to a separate header so it can be used outside of the compiler (#130930) 2025-03-13 16:02:58 +00:00
pycore_call.h gh-148659: Export some internal functions for the JIT (PEP-523) (#148634) 2026-04-17 01:55:03 +02:00
pycore_capsule.h gh-108240: Add pycore_capsule.h internal header file (#108596) 2023-08-29 01:20:02 +00:00
pycore_cell.h gh-144490: Fix C++ compatibility in pycore_cell.h (GH-144482) 2026-02-06 22:11:58 -05:00
pycore_ceval.h GH-126910: Add gdb support for unwinding JIT frames (#146071) 2026-05-02 13:42:03 +00:00
pycore_ceval_state.h gh-131238: Remove pycore_lock.h includes (#131483) 2025-03-19 23:46:25 +00:00
pycore_code.h gh-137030: Fix YIELD_VALUE bytecode assertion (#149184) 2026-05-04 18:09:57 +02:00
pycore_codecs.h gh-131238: Remove pycore_lock.h includes (#131483) 2025-03-19 23:46:25 +00:00
pycore_compile.h gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
pycore_complexobject.h gh-128813: hide mixed-mode functions for complex arithmetic from C-API (#131703) 2025-04-22 14:18:18 +02:00
pycore_condvar.h gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044) 2025-03-11 12:33:01 +01:00
pycore_context.h gh-140414: streamline thread state access in asyncio (#142742) 2025-12-15 16:57:51 +05:30
pycore_critical_section.h [3.15] gh-150902: Optimize PyCriticalSection2 to skip locking the same locks held by the current CS2 (gh-151554) 2026-06-19 09:52:07 -04:00
pycore_crossinterp.h gh-148072: Cache pickle.dumps/loads per interpreter in XIData (GH-148125) 2026-04-06 11:37:02 -04:00
pycore_crossinterp_data_registry.h gh-132775: Support Fallbacks in _PyObject_GetXIData() (gh-133482) 2025-05-21 07:23:48 -06:00
pycore_debug_offsets.h [3.15] gh-151613: Fix remote debugging frame cache ABA (#152448) 2026-06-27 17:42:31 +00:00
pycore_descrobject.h gh-41779: Allow defining any __slots__ for a class derived from tuple (GH-141763) 2026-01-06 11:36:00 +02:00
pycore_dict.h gh-143732: allow dict subclasses to be specialized (GH-148128) 2026-05-04 09:39:03 +01:00
pycore_dict_state.h [3.15] gh-145235: Make dict watcher API thread-safe for free-threaded builds (gh-145233) (#149690) 2026-05-11 14:23:39 -04:00
pycore_dtoa.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_emscripten_signal.h GH-108614: Unbreak emscripten build (GH-109132) 2023-09-08 17:54:45 +01:00
pycore_emscripten_trampoline.h gh-145037: Fix Emscripten trampoline with emcc >= 4.0.19 (#145038) 2026-02-26 06:21:05 +08:00
pycore_exceptions.h gh-129668: Fix thread-safety of MemoryError freelist in free threaded build (gh-129704) 2025-02-06 12:38:12 -05:00
pycore_faulthandler.h gh-149085: Add max_threads keyword to faulthandler.dump_traceback() (GH-149106) 2026-04-30 09:27:57 -04:00
pycore_fileutils.h gh-131238: Use pycore_interp_structs.h header (#131481) 2025-03-19 23:13:25 +00:00
pycore_fileutils_windows.h gh-108220: Internal header files require Py_BUILD_CORE to be defined (#108221) 2023-08-21 19:15:52 +02:00
pycore_floatobject.h gh-145633: Remove support for ancient ARM platforms with mixed-endian doubles (#145634) 2026-03-11 12:39:24 +01:00
pycore_flowgraph.h GH-143493: Conform to spec for generator expressions while supporting virtual iterators (GH-143569) 2026-01-16 09:11:58 +00:00
pycore_format.h gh-104018: remove unused format "z" handling in string formatfloat() (#104107) 2023-05-07 10:11:42 +05:30
pycore_frame.h gh-148659: Export some internal functions for the JIT (PEP-523) (#148634) 2026-04-17 01:55:03 +02:00
pycore_freelist.h gh-140544: store pointer to interpreter state as a thread local for fast access (#140573) 2025-10-25 19:56:07 +05:30
pycore_freelist_state.h gh-129813, PEP 782: Add PyBytesWriter C API (#138822) 2025-09-12 13:41:59 +02:00
pycore_function.h gh-148659: Export some internal functions for the JIT (PEP-523) (#148634) 2026-04-17 01:55:03 +02:00
pycore_gc.h [3.15] gh-150766: export _PyGC_VisitFrameStack and _PyGC_VisitStackRef functions (GH-150767) (#150787) 2026-06-02 13:36:52 +00:00
pycore_genobject.h GH-143732: SEND specialization (GH-148963) 2026-05-05 15:19:16 +01:00
pycore_getopt.h bpo-36763: Cleanup precmdline in _PyCoreConfig_Read() (GH-13371) 2019-05-17 03:15:12 +02:00
pycore_gil.h gh-116322: Enable the GIL while loading C extension modules (#118560) 2024-05-06 23:07:23 -04:00
pycore_global_objects.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_global_objects_fini_generated.h [3.15] gh-148829: Make sentinels' repr and module customizable (GH-149654) (#150092) 2026-05-22 07:44:34 -07:00
pycore_global_strings.h [3.15] gh-148829: Make sentinels' repr and module customizable (GH-149654) (#150092) 2026-05-22 07:44:34 -07:00
pycore_hamt.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_hashtable.h gh-107211: No longer export internal functions (5) (#108423) 2023-08-24 16:06:53 +00:00
pycore_import.h [3.15] gh-150052: Resolve un-loaded lazily loaded submodules via module.__getattr__ instead of publishing lazy values (#150055) 2026-05-19 21:23:30 +00:00
pycore_importdl.h gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055) 2026-05-05 09:18:04 +02:00
pycore_index_pool.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_initconfig.h gh-116749: Fix code comment for _PyConfig_GIL_DEFAULT (gh-141804) 2025-11-24 10:42:00 -05:00
pycore_instruction_sequence.h GH-143493: Conform to spec for generator expressions while supporting virtual iterators (GH-143569) 2026-01-16 09:11:58 +00:00
pycore_instruments.h gh-142186: Allow all PEP-669 events to be per-code object and disableable (GH-146182) 2026-04-22 09:08:23 +01:00
pycore_interp.h gh-131238: Remove includes from pycore_interp.h (#131495) 2025-03-20 11:35:23 +00:00
pycore_interp_structs.h [3.15] gh-148587: Make sys.lazy_modules match PEP and keep internal lazy submodules tra… (#150014) 2026-05-18 17:53:54 -07:00
pycore_interpframe.h [3.15] gh-151613: Fix remote debugging frame cache ABA (#152448) 2026-06-27 17:42:31 +00:00
pycore_interpframe_structs.h GH-140643: Add <native> and <GC> frames to the sampling profiler (#141108) 2025-11-17 13:39:00 +00:00
pycore_interpolation.h gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
pycore_intrinsics.h gh-116126: Implement PEP 696 (#116129) 2024-05-03 06:17:32 -07:00
pycore_jit.h GH-126910: Add gdb support for unwinding JIT frames (#146071) 2026-05-02 13:42:03 +00:00
pycore_jit_publish.h GH-126910: Add GNU backtrace support for unwinding JIT frames (#149104) 2026-05-05 09:29:07 +01:00
pycore_jit_unwind.h [3.15] gh-149685: Use the _Py prefix for private C macros (GH-149686) (GH-149790) 2026-05-13 23:29:08 +02:00
pycore_lazyimportobject.h gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
pycore_list.h gh-100239: Specialize more binary operations using BINARY_OP_EXTEND (GH-128956) 2026-04-16 09:22:41 +01:00
pycore_llist.h gh-111964: Implement stop-the-world pauses (gh-112471) 2024-01-23 11:08:23 -07:00
pycore_lock.h gh-120321: Make gi_yieldfrom thread-safe in free-threading build (#144292) 2026-01-30 12:20:27 -05:00
pycore_long.h gh-143050: Add helper _PyLong_InitTag() (#147956) 2026-04-01 21:42:10 +00:00
pycore_magic_number.h GH-143732: SEND specialization (GH-148963) 2026-05-05 15:19:16 +01:00
pycore_memoryobject.h gh-132776: Revert Moving memoryview XIData Code to memoryobject.c (gh-132960) 2025-04-25 16:43:50 +00:00
pycore_mimalloc.h gh-122584: Import mimalloc headers in a C++ context (#122587) 2024-08-15 09:01:01 -04:00
pycore_mmap.h [3.15] gh-149685: Use the _Py prefix for private C macros (GH-149686) (GH-149790) 2026-05-13 23:29:08 +02:00
pycore_modsupport.h gh-129594: Remove redundant check on varargs in _PyArg_CheckPositional (#129595) 2025-05-26 10:51:12 +02:00
pycore_moduleobject.h gh-145921: Add "_DuringGC" functions for tp_traverse (GH-145925) 2026-04-08 09:15:11 +02:00
pycore_namespace.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_object.h gh-148659: Export some internal functions for the JIT (PEP-523) (#148634) 2026-04-17 01:55:03 +02:00
pycore_object_alloc.h gh-112529: Use GC heaps for GC allocations in free-threaded builds (gh-114157) 2024-01-21 01:14:45 +09:00
pycore_object_deferred.h gh-117139: Convert the evaluation stack to stack refs (#118450) 2024-06-27 03:10:43 +08:00
pycore_object_stack.h gh-125859: Fix crash when gc.get_objects is called during GC (#125882) 2024-10-24 09:33:11 -04:00
pycore_object_state.h gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
pycore_obmalloc.h Note out-of-date obmalloc comments (#148149) 2026-04-06 23:08:47 -05:00
pycore_obmalloc_init.h gh-113055: Use pointer for interp->obmalloc state (gh-113412) 2024-01-26 19:38:14 -08:00
pycore_opcode_metadata.h GH-143732: SEND specialization (GH-148963) 2026-05-05 15:19:16 +01:00
pycore_opcode_utils.h gh-148871: extend and improve LOAD_COMMON_CONSTANT (GH-148971) 2026-05-02 19:59:51 +01:00
pycore_optimizer.h [3.15] gh-149335: Avoid JIT trace buffer asserts with overhead above FITNESS_INITIAL (GH-149633) (#150245) 2026-05-24 12:48:58 +05:30
pycore_optimizer_types.h gh-146261: JIT: protect against function version changes (#146300) 2026-04-13 02:23:47 +08:00
pycore_parking_lot.h gh-110850: Cleanup pycore_time.h includes (#115724) 2024-02-20 16:50:43 +00:00
pycore_parser.h gh-122581: Use parser mutex in default build for subinterpreters (gh-142959) 2025-12-20 15:37:31 -05:00
pycore_pathconfig.h gh-107211: No longer export internal functions (6) (#108424) 2023-08-24 17:28:35 +02:00
pycore_pyarena.h gh-107211: Fix test_peg_generator (#108435) 2023-08-24 17:47:44 +00:00
pycore_pyatomic_ft_wrappers.h [3.15] gh-145235: Make dict watcher API thread-safe for free-threaded builds (gh-145233) (#149690) 2026-05-11 14:23:39 -04:00
pycore_pybuffer.h gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791) 2024-04-24 16:18:24 +00:00
pycore_pyerrors.h gh-148659: Export some internal functions for the JIT (PEP-523) (#148634) 2026-04-17 01:55:03 +02:00
pycore_pyhash.h [3.15] gh-149018: Use XML_SetHashSalt16Bytes in pyexpat/_elementtree when possible (#149645) 2026-05-24 14:36:30 +01:00
pycore_pylifecycle.h gh-136421: Load _datetime static types during interpreter initialization (GH-136583) 2025-07-21 13:47:26 -04:00
pycore_pymath.h gh-145633: Remove support for ancient ARM platforms with mixed-endian doubles (#145634) 2026-03-11 12:39:24 +01:00
pycore_pymem.h gh-116008: Detect freed thread state in faulthandler (#141988) 2025-11-27 12:35:00 +01:00
pycore_pymem_init.h gh-144914: use mimalloc for raw allocations on free-threading (#144916) 2026-02-18 04:16:27 +00:00
pycore_pystate.h gh-149101: Implement PEP 788 (GH-149116) 2026-05-06 17:39:30 -04:00
pycore_pystats.h gh-131253: free-threaded build support for pystats (gh-137189) 2025-11-03 11:36:37 -08:00
pycore_pythonrun.h GH-126910: Revert "Make _Py_get_machine_stack_pointer return the stack pointer (#147945)" (GH-147994) 2026-04-02 16:53:09 +02:00
pycore_pythread.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_qsbr.h gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554) 2026-02-17 11:12:25 -05:00
pycore_range.h gh-89189: More compact range iterator (GH-27986) 2022-11-30 23:04:30 +02:00
pycore_runtime.h gh-146302: make Py_IsInitialized() thread-safe and reflect true init completion (GH-146303) 2026-04-11 21:54:23 +00:00
pycore_runtime_init.h GH-148726: Forward-port generational GC. (GH-148746) 2026-04-30 12:19:13 -07:00
pycore_runtime_init_generated.h [3.15] gh-148829: Make sentinels' repr and module customizable (GH-149654) (#150092) 2026-05-22 07:44:34 -07:00
pycore_runtime_structs.h gh-146302: make Py_IsInitialized() thread-safe and reflect true init completion (GH-146303) 2026-04-11 21:54:23 +00:00
pycore_semaphore.h gh-137433: Fix deadlock with stop-the-world and daemon threads (gh-137735) 2025-09-16 09:21:58 +01:00
pycore_setobject.h gh-130312: SET_ADD should not lock (#130136) 2025-03-21 15:58:32 -07:00
pycore_signal.h gh-109693: Use pyatomic.h for signal module (gh-110480) 2023-10-10 08:26:29 +09:00
pycore_sliceobject.h GH-115802: JIT "small" code for Windows (GH-115964) 2024-02-29 08:11:28 -08:00
pycore_slots.h gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055) 2026-05-05 09:18:04 +02:00
pycore_slots_generated.h gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055) 2026-05-05 09:18:04 +02:00
pycore_stackref.h gh-148718: Fix Py_STACKREF_DEBUG build by defining macros (#148719) 2026-04-20 21:55:03 +09:00
pycore_stats.h gh-131253: free-threaded build support for pystats (gh-137189) 2025-11-03 11:36:37 -08:00
pycore_strhex.h gh-147944: Increase range of bytes_per_sep (GH-147946) 2026-04-01 08:33:30 +00:00
pycore_structs.h GH-131498: Cases generator: manage stacks automatically (GH-132074) 2025-04-04 17:59:36 +01:00
pycore_structseq.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_symtable.h gh-137814: Fix __qualname__ of __annotate__ (#137842) 2026-04-15 21:52:30 -07:00
pycore_sysmodule.h gh-108512: Add and use new replacements for PySys_GetObject() (GH-111035) 2025-05-28 20:11:09 +03:00
pycore_template.h gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
pycore_time.h Remove internal _PyTime_AsLong() function (#141053) 2025-11-05 18:37:06 +01:00
pycore_token.h gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
pycore_traceback.h gh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads() (#148145) 2026-05-06 15:01:12 +00:00
pycore_tracemalloc.h gh-143057: avoid locking in tracemalloc C-APIs when it is not enabled (#143065) 2025-12-22 21:08:07 +05:30
pycore_tstate.h gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554) 2026-02-17 11:12:25 -05:00
pycore_tuple.h gh-100239: Specialize more binary operations using BINARY_OP_EXTEND (GH-128956) 2026-04-16 09:22:41 +01:00
pycore_typedefs.h gh-130931: Add pycore_typedefs.h internal header (#131396) 2025-03-19 15:23:32 +01:00
pycore_typeobject.h [3.15] gh-149481: skip FOR_ITER inline specialization for Python __next__ (GH-149491) (#149523) 2026-05-07 19:08:12 -07:00
pycore_typevarobject.h gh-119180: Add evaluate functions for type params and type aliases (#122212) 2024-07-27 17:24:10 +00:00
pycore_ucnhash.h gh-111972: Make Unicode name C APIcapsule initialization thread-safe (#112249) 2023-11-30 11:12:49 +01:00
pycore_unicodectype.h gh-129117: Add unicodedata.isxidstart() function (#140269) 2025-10-30 10:18:12 +00:00
pycore_unicodeobject.h gh-103997: Remove incorrect statements about -c dedenting (gh-138624) 2026-03-10 09:56:00 +01:00
pycore_unicodeobject_generated.h [3.15] gh-148829: Make sentinels' repr and module customizable (GH-149654) (#150092) 2026-05-22 07:44:34 -07:00
pycore_unionobject.h gh-105499: Merge typing.Union and types.UnionType (#105511) 2025-03-04 11:44:19 -08:00
pycore_uniqueid.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_uop.h [3.15] gh-149335: Avoid JIT trace buffer asserts with overhead above FITNESS_INITIAL (GH-149633) (#150245) 2026-05-24 12:48:58 +05:30
pycore_uop_ids.h GH-143732: SEND specialization (GH-148963) 2026-05-05 15:19:16 +01:00
pycore_uop_metadata.h GH-143732: SEND specialization (GH-148963) 2026-05-05 15:19:16 +01:00
pycore_warnings.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_weakref.h gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) 2025-06-30 11:14:31 +00:00