cpython/Include/internal
Sam Gross ca22147547
gh-111924: Fix data races when swapping allocators (gh-130287)
CPython current temporarily changes `PYMEM_DOMAIN_RAW` to the default
allocator during initialization and shutdown. The motivation is to
ensure that core runtime structures are allocated and freed using the
same allocator. However, modifying the current allocator changes global
state and is not thread-safe even with the GIL. Other threads may be
allocating or freeing objects use PYMEM_DOMAIN_RAW; they are not
required to hold the GIL to call PyMem_RawMalloc/PyMem_RawFree.

This adds new internal-only functions like `_PyMem_DefaultRawMalloc`
that aren't affected by calls to `PyMem_SetAllocator()`, so they're
appropriate for Python runtime initialization and finalization. Use
these calls in places where we previously swapped to the default raw
allocator.
2025-02-20 11:31:15 -05:00
..
mimalloc gh-125444: Fix illegal instruction for older Arm architectures (#125574) 2024-10-16 09:13:07 -04:00
pycore_abstract.h
pycore_asdl.h
pycore_ast.h gh-130139: always check ast node type in ast.parse() with ast input (#130140) 2025-02-16 13:32:39 +00:00
pycore_ast_state.h gh-116126: Implement PEP 696 (#116129) 2024-05-03 06:17:32 -07:00
pycore_atexit.h gh-126907: make atexit thread safe in free-threading (#127935) 2024-12-16 19:31:44 +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-126795: Increase the JIT side-exit threshold from 64 to 4096 (GH-127155) 2024-12-04 15:01:28 -08:00
pycore_bitutils.h
pycore_blocks_output_buffer.h
pycore_brc.h gh-110481: Implement inter-thread queue for biased reference counting (#114824) 2024-02-09 17:08:32 -05:00
pycore_bytes_methods.h gh-117431: Adapt bytes and bytearray .find() and friends to Argument Clinic (#117502) 2024-04-12 07:40:55 +00:00
pycore_bytesobject.h gh-121489: Export private _PyBytes_Join() again (#122267) 2024-07-25 17:31:30 +02:00
pycore_call.h gh-120686: remove unused internal c api functions (#120687) 2024-06-27 11:09:30 +01:00
pycore_capsule.h
pycore_cell.h gh-117323: Make cell thread-safe in free-threaded builds (#117330) 2024-03-29 13:35:43 -04:00
pycore_ceval.h GH-91079: Implement C stack limits using addresses, not counters. (GH-130007) 2025-02-19 11:44:57 +00:00
pycore_ceval_state.h gh-118518: Allow perf to work without frame pointers (#112254) 2024-05-05 03:07:29 +02:00
pycore_code.h gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR (#129700) 2025-02-07 22:39:54 +00:00
pycore_codecs.h gh-124665: Add _PyCodec_UnregisterError and _codecs._unregister_error (#124677) 2024-09-29 02:25:23 +02:00
pycore_compile.h gh-123969: refactor _PyErr_RaiseSyntaxError and _PyErr_EmitSyntaxWarning out of compiler (#123972) 2024-09-16 15:05:00 +01:00
pycore_complexobject.h
pycore_condvar.h gh-104530: Enable native Win32 condition variables by default (GH-104531) 2024-02-02 13:50:51 +00:00
pycore_context.h gh-119333: Add C api to have contextvar enter/exit callbacks (#119335) 2024-09-23 20:40:17 -07:00
pycore_critical_section.h gh-114203: Optimise simple recursive critical sections (#128126) 2024-12-23 13:31:33 +01:00
pycore_crossinterp.h gh-76785: Improved Subinterpreters Compatibility with 3.12 (2/2) (gh-126707) 2024-11-12 10:41:51 -07:00
pycore_crossinterp_data_registry.h gh-76785: Improved Subinterpreters Compatibility with 3.12 (2/2) (gh-126707) 2024-11-12 10:41:51 -07:00
pycore_debug_offsets.h gh-129223: Do not allow the compiler to optimise away symbols for debug sections (#129225) 2025-01-24 21:36:32 +01:00
pycore_descrobject.h
pycore_dict.h gh-128923: Use zero to indicate unassigned unique id (#128925) 2025-01-17 16:42:27 +01:00
pycore_dict_state.h gh-124296: Remove private dictionary version tag (PEP 699) (#124472) 2024-10-01 12:39:56 -04:00
pycore_dtoa.h gh-119447: Fix build with _PY_SHORT_FLOAT_REPR == 0 (#121178) 2024-06-30 11:40:40 +02:00
pycore_emscripten_signal.h
pycore_emscripten_trampoline.h gh-128627: Emscripten: Use wasm-gc based call adaptor if available (#128628) 2025-01-13 07:09:39 +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
pycore_fileutils.h gh-118422: Fix run_fileexflags() test (#118429) 2024-04-30 22:32:55 +02:00
pycore_fileutils_windows.h
pycore_floatobject.h gh-69639: Add mixed-mode rules for complex arithmetic (C-like) (GH-124829) 2024-11-26 17:57:39 +02:00
pycore_flowgraph.h gh-119744: move a few functions from compile.c to flowgraph.c (#119745) 2024-05-30 21:55:06 +01:00
pycore_format.h
pycore_frame.h gh-129236: Use stackpointer in free threaded GC (#129240) 2025-01-29 10:40:51 -05:00
pycore_freelist.h gh-127879: Fix data race in _PyFreeList_Push (#127880) 2024-12-12 12:59:13 -05:00
pycore_freelist_state.h gh-126703: Add freelists for list and tuple iterators (GH-128592) 2025-01-29 09:15:24 +00:00
pycore_function.h gh-115999: Stop the world when invalidating function versions (#124997) 2024-10-08 10:04:35 -04:00
pycore_gc.h gh-128807: Add marking phase for free-threaded cyclic GC (gh-128808) 2025-01-15 11:27:28 -08:00
pycore_genobject.h gh-120834: fix type of *_iframe field in _PyGenObject_HEAD declaration (#120835) 2024-06-24 10:23:38 +01:00
pycore_getopt.h
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-129701: Fix a data race in intern_common in the free threaded build (GH-130089) 2025-02-17 14:15:40 +01:00
pycore_global_objects_fini_generated.h GH-126833: Dumps graphviz representation of executor graph. (GH-126880) 2024-12-13 11:00:00 +00:00
pycore_global_strings.h GH-126833: Dumps graphviz representation of executor graph. (GH-126880) 2024-12-13 11:00:00 +00:00
pycore_hamt.h
pycore_hashtable.h
pycore_import.h gh-128911: Add PyImport_ImportModuleAttr() function (#128912) 2025-01-30 11:17:29 +00:00
pycore_importdl.h gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952) 2024-08-13 14:44:57 -06:00
pycore_index_pool.h gh-115999: Implement thread-local bytecode and enable specialization for BINARY_OP (#123926) 2024-11-04 11:13:32 -08:00
pycore_initconfig.h gh-107954, PEP 741: Add PyConfig_Get()/Set() functions (#123472) 2024-09-02 23:25:08 +02:00
pycore_instruction_sequence.h gh-121404: split compile.c into compile.c and codegen.c (#123651) 2024-09-09 18:21:51 +01:00
pycore_instruments.h GH-128375: Better instrument for FOR_ITER (GH-128445) 2025-01-06 17:54:47 +00:00
pycore_interp.h gh-128002: use per threads tasks linked list in asyncio (#128869) 2025-02-06 19:51:07 +01:00
pycore_intrinsics.h gh-116126: Implement PEP 696 (#116129) 2024-05-03 06:17:32 -07:00
pycore_jit.h gh-117139: Convert the evaluation stack to stack refs (#118450) 2024-06-27 03:10:43 +08:00
pycore_list.h GH-128682: Change a couple of functions to only steal references on success. (GH-129132) 2025-01-22 10:51:37 +00:00
pycore_llist.h
pycore_lock.h gh-128002: use per threads tasks linked list in asyncio (#128869) 2025-02-06 19:51:07 +01:00
pycore_long.h gh-126835: Move constant subscript folding to CFG (#129568) 2025-02-04 10:10:55 +02:00
pycore_magic_number.h gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR (#129700) 2025-02-07 22:39:54 +00:00
pycore_memoryobject.h
pycore_mimalloc.h gh-122584: Import mimalloc headers in a C++ context (#122587) 2024-08-15 09:01:01 -04:00
pycore_modsupport.h gh-112136: Remove unused #include "pycore_lock.h" (#127093) 2024-11-21 13:50:11 +01:00
pycore_moduleobject.h gh-123930: Better error for "from imports" when script shadows module (#123929) 2024-10-24 12:11:12 -07:00
pycore_namespace.h
pycore_object.h gh-129984: Mark immortal objects as deferred (#129985) 2025-02-13 09:01:43 -08:00
pycore_object_alloc.h
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 gh-92953: Improve nextpool/prevpool comment. (gh-125545) 2024-10-15 11:47:20 -07: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-128682: Account for escapes in DECREF_INPUTS (GH-129953) 2025-02-12 17:44:59 +00:00
pycore_opcode_utils.h GH-122548: Implement branch taken and not taken events for sys.monitoring (GH-122564) 2024-12-19 16:59:51 +00:00
pycore_optimizer.h GH-129715: Remove _DYNAMIC_EXIT (GH-129716) 2025-02-07 11:41:17 -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: Avoid data races when collecting parser statistics (#122694) 2024-08-06 13:29:57 +02:00
pycore_pathconfig.h
pycore_pyarena.h
pycore_pyatomic_ft_wrappers.h gh-117657: TSAN Fix races in PyMember_Get and PyMember_Set for C extensions (GH-123211) 2024-12-03 09:41:53 -05:00
pycore_pybuffer.h gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791) 2024-04-24 16:18:24 +00:00
pycore_pyerrors.h gh-127787: allow retrieving the clipped slice length in _PyUnicodeError_GetParams (GH-128980) 2025-01-21 11:45:53 +01:00
pycore_pyhash.h gh-122854: Add Py_HashBuffer() function (#122855) 2024-08-30 15:42:27 +00:00
pycore_pylifecycle.h gh-128130: Fix unhandled keyboard interrupt data race (gh-129975) 2025-02-13 12:29:03 -05:00
pycore_pymath.h gh-120026: soft deprecate Py_HUGE_VAL macro (#120027) 2024-11-01 22:04:31 +00:00
pycore_pymem.h gh-111924: Fix data races when swapping allocators (gh-130287) 2025-02-20 11:31:15 -05:00
pycore_pymem_init.h gh-115103: Implement delayed free mechanism for free-threaded builds (#115367) 2024-02-20 13:04:37 -05:00
pycore_pystate.h gh-128002: use per threads tasks linked list in asyncio (#128869) 2025-02-06 19:51:07 +01:00
pycore_pystats.h
pycore_pythonrun.h
pycore_pythread.h gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) 2024-10-02 09:17:49 -07:00
pycore_qsbr.h gh-117657: Fix QSBR race condition (#118843) 2024-05-10 10:26:35 -04:00
pycore_range.h
pycore_runtime.h gh-128627: Emscripten: Use wasm-gc based call adaptor if available (#128628) 2025-01-13 07:09:39 +08:00
pycore_runtime_init.h GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-127110) 2024-12-02 10:12:17 +00:00
pycore_runtime_init_generated.h GH-126833: Dumps graphviz representation of executor graph. (GH-126880) 2024-12-13 11:00:00 +00:00
pycore_semaphore.h gh-110850: Cleanup pycore_time.h includes (#115724) 2024-02-20 16:50:43 +00:00
pycore_setobject.h gh-118527: Intern code consts in free-threaded build (#118667) 2024-05-06 20:12:39 -04:00
pycore_signal.h
pycore_sliceobject.h GH-115802: JIT "small" code for Windows (GH-115964) 2024-02-29 08:11:28 -08:00
pycore_stackref.h gh-129984: Mark immortal objects as deferred (#129985) 2025-02-13 09:01:43 -08:00
pycore_strhex.h
pycore_structseq.h
pycore_symtable.h GH-91079: Implement C stack limits using addresses, not counters. (GH-130007) 2025-02-19 11:44:57 +00:00
pycore_sysmodule.h gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
pycore_time.h gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) 2024-07-19 08:06:02 +00:00
pycore_token.h
pycore_traceback.h
pycore_tracemalloc.h gh-129185: Use PyMutex in tracemalloc (#129246) 2025-01-24 11:25:24 +01:00
pycore_tstate.h GH-91079: Implement C stack limits using addresses, not counters. (GH-130007) 2025-02-19 11:44:57 +00:00
pycore_tuple.h GH-128682: Change a couple of functions to only steal references on success. (GH-129132) 2025-01-22 10:51:37 +00:00
pycore_typeobject.h gh-115999: Enable BINARY_SUBSCR_GETITEM for free-threaded build (gh-127737) 2024-12-19 11:08:17 +09: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
pycore_unicodeobject.h gh-124502: Remove _PyUnicode_EQ() function (#125114) 2024-10-09 10:15:17 +02:00
pycore_unicodeobject_generated.h GH-126833: Dumps graphviz representation of executor graph. (GH-126880) 2024-12-13 11:00:00 +00:00
pycore_unionobject.h gh-105858: Expose some union-related objects as internal APIs (GH-116025) 2024-02-28 09:56:40 +00:00
pycore_uniqueid.h gh-128923: Use zero to indicate unassigned unique id (#128925) 2025-01-17 16:42:27 +01:00
pycore_uop_ids.h gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR (#129700) 2025-02-07 22:39:54 +00:00
pycore_uop_metadata.h GH-128682: Account for escapes in DECREF_INPUTS (GH-129953) 2025-02-12 17:44:59 +00:00
pycore_warnings.h gh-128384: Add locking to warnings.py. (gh-128386) 2025-01-14 11:43:42 -08:00
pycore_weakref.h gh-118789: Add PyUnstable_Object_ClearWeakRefsNoCallbacks (#118807) 2024-06-18 09:57:23 -04:00