cpython/Include/internal
Eric Snow 8ba4df91ae
gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974)
This fixes a crasher due to a race condition, triggered infrequently when two isolated (own GIL) subinterpreters simultaneously initialize their sys or builtins modules.  The crash happened due the combination of the "detached" thread state we were using and the "last holder" logic we use for the GIL.  It turns out it's tricky to use the same thread state for different threads.  Who could have guessed?

We solve the problem by eliminating the one object we were still sharing between interpreters.  We replace it with a low-level hashtable, using the "raw" allocator to avoid tying it to the main interpreter.

We also remove the accommodations for "detached" thread states, which were a dubious idea to start with.
2023-07-28 14:39:08 -06:00
..
pycore_abstract.h gh-106084: Remove _PyObject_RealIsInstance() function (#106106) 2023-06-26 13:38:41 +00:00
pycore_asdl.h gh-87347: Add parenthesis around macro arguments (#93915) 2022-06-20 16:04:52 +02:00
pycore_ast.h gh-104799: Move location of type_params AST fields (#104828) 2023-05-26 05:54:37 -07:00
pycore_ast_state.h gh-104656: Rename typeparams AST node to type_params (#104657) 2023-05-21 21:25:09 -07:00
pycore_atexit.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_atomic.h Fix typo in internal/pycore_atomic.h (GH-95939) 2022-08-13 11:40:41 +08:00
pycore_atomic_funcs.h
pycore_bitutils.h bpo-29882: Fix portability bug introduced in GH-30774 (#30794) 2022-01-23 09:59:34 +00:00
pycore_blocks_output_buffer.h bpo-44458: Ensure BUFFER_BLOCK_SIZE symbol is statically allocated. (GH-26808) 2021-06-21 23:36:36 -07:00
pycore_bytes_methods.h
pycore_bytesobject.h gh-106320: Remove _PyBytes_Join() C API (#107144) 2023-07-23 20:10:12 +00:00
pycore_call.h gh-107211: No longer export internal functions (1) (#107213) 2023-07-25 03:44:11 +02:00
pycore_ceval.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_ceval_state.h GH-104580: Put eval_breaker back at the start of the interpreter state. (GH-107383) 2023-07-28 13:55:25 +01:00
pycore_code.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_codecs.h gh-86085: Remove _PyCodec_Forget() declaration (#106377) 2023-07-04 00:52:27 +02:00
pycore_compile.h gh-107211: No longer export internal functions (1) (#107213) 2023-07-25 03:44:11 +02:00
pycore_complexobject.h gh-106320: Move _PyUnicodeWriter to the internal C API (#106342) 2023-07-03 10:23:43 +02:00
pycore_condvar.h bpo-46315: Add ifdef HAVE_ feature checks for WASI compatibility (GH-30507) 2022-01-13 09:46:04 +01:00
pycore_context.h gh-81057: Move contextvars-related Globals to _PyRuntimeState (gh-99400) 2022-11-16 09:54:28 -07:00
pycore_descrobject.h gh-106320: Move _PyMethodWrapper_Type to internal C API (#107064) 2023-07-22 20:57:59 +00:00
pycore_dict.h gh-106320: Remove private _PyDict C API (#107145) 2023-07-24 14:02:03 +00:00
pycore_dict_state.h gh-104252: Immortalize Py_EMPTY_KEYS (gh-104253) 2023-05-10 07:28:40 -06:00
pycore_dtoa.h gh-107211: No longer export internal functions (1) (#107213) 2023-07-25 03:44:11 +02:00
pycore_emscripten_signal.h bpo-47176: Interrupt handling for wasm32-emscripten builds without pthreads (GH-32209) 2022-04-03 22:58:52 +02:00
pycore_exceptions.h bpo-46417: Factorize _PyExc_InitTypes() code (GH-30804) 2022-01-22 21:48:56 +01:00
pycore_faulthandler.h gh-81057: Move faulthandler Globals to _PyRuntimeState (gh-100152) 2022-12-12 09:58:46 -07:00
pycore_fileutils.h gh-107211: No longer export internal functions (1) (#107213) 2023-07-25 03:44:11 +02:00
pycore_fileutils_windows.h gh-102765: Update ntpath.isdir/isfile/islink/exists to use GetFileInformationByName when available (GH-103485) 2023-04-27 14:23:26 +00:00
pycore_floatobject.h gh-107211: No longer export internal functions (1) (#107213) 2023-07-25 03:44:11 +02:00
pycore_flowgraph.h gh-106149: Simplify stack depth calculation. Replace asserts by exceptions. (#107255) 2023-07-26 13:32:47 +01: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-106869: Use new PyMemberDef constant names (#106871) 2023-07-25 15:28:30 +02:00
pycore_function.h gh-106320: Remove _PyFunction_Vectorcall() API (#107071) 2023-07-22 21:44:33 +00:00
pycore_gc.h gh-105268: Add _Py_FROM_GC() function to pycore_gc.h (#105362) 2023-06-06 14:44:48 +02:00
pycore_genobject.h gh-107211: No longer export internal functions (1) (#107213) 2023-07-25 03:44:11 +02:00
pycore_getopt.h
pycore_gil.h
pycore_global_objects.h gh-106931: Intern Statically Allocated Strings Globally (gh-107272) 2023-07-27 13:56:59 -06:00
pycore_global_objects_fini_generated.h gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304) 2023-07-09 15:27:03 +03:00
pycore_global_strings.h gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304) 2023-07-09 15:27:03 +03:00
pycore_hamt.h gh-81057: Move contextvars-related Globals to _PyRuntimeState (gh-99400) 2022-11-16 09:54:28 -07:00
pycore_hashtable.h gh-106931: Intern Statically Allocated Strings Globally (gh-107272) 2023-07-27 13:56:59 -06:00
pycore_import.h gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974) 2023-07-28 14:39:08 -06:00
pycore_initconfig.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_instruments.h GH-106895: Raise a ValueError when attempting to disable events that cannot be disabled. (GH-107337) 2023-07-27 15:27:11 +01:00
pycore_interp.h GH-104580: Put eval_breaker back at the start of the interpreter state. (GH-107383) 2023-07-28 13:55:25 +01:00
pycore_intrinsics.h gh-105481: do not auto-generate pycore_intrinsics.h (#106913) 2023-07-20 17:46:04 +01:00
pycore_list.h gh-106168: PyTuple_SET_ITEM() now checks the index (#106164) 2023-06-28 03:45:57 +02:00
pycore_long.h gh-107211: No longer export internal variables (#107218) 2023-07-25 03:48:04 +00:00
pycore_memoryobject.h gh-104223: Fix issues with inheriting from buffer classes (#104227) 2023-05-08 09:52:41 -07:00
pycore_modsupport.h gh-106320: Create pycore_modsupport.h header file (#106355) 2023-07-03 09:39:11 +00:00
pycore_moduleobject.h gh-106320: Remove private _PyModule API (#107070) 2023-07-22 21:41:11 +00: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-107211: No longer export internal variables (#107218) 2023-07-25 03:48:04 +00:00
pycore_object_state.h gh-102304: Move the Total Refcount to PyInterpreterState (gh-102545) 2023-03-21 11:46:09 -06:00
pycore_obmalloc.h gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660) 2023-04-24 17:23:57 -06:00
pycore_obmalloc_init.h gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660) 2023-04-24 17:23:57 -06:00
pycore_opcode.h gh-105481: remove dependency of _inline_cache_entries on opname (#107339) 2023-07-27 14:15:25 +01:00
pycore_opcode_metadata.h gh-105481: Generate the opcode lists in dis from data extracted from bytecodes.c (#106758) 2023-07-18 19:42:44 +01:00
pycore_opcode_utils.h gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions (#105865) 2023-06-17 17:00:16 +01:00
pycore_parser.h gh-81057: Move the Cached Parser Dummy Name to _PyRuntimeState (#100277) 2022-12-16 13:48:03 +00:00
pycore_pathconfig.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_pyarena.h gh-107211: No longer export internal functions (2) (#107214) 2023-07-25 03:49:28 +02:00
pycore_pyerrors.h gh-107211: No longer export internal functions (2) (#107214) 2023-07-25 03:49:28 +02:00
pycore_pyhash.h gh-107211: No longer export internal variables (#107218) 2023-07-25 03:48:04 +00:00
pycore_pylifecycle.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_pymath.h Remove unused internal macros (#102415) 2023-03-04 12:20:14 +00:00
pycore_pymem.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_pymem_init.h gh-81057: Move the Allocators to _PyRuntimeState (gh-99217) 2022-11-11 16:30:46 -07:00
pycore_pystate.h gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974) 2023-07-28 14:39:08 -06:00
pycore_pythread.h gh-81057: Fix the wasm32-wasi Buildbot (gh-100139) 2022-12-09 10:17:54 -07:00
pycore_range.h gh-89189: More compact range iterator (GH-27986) 2022-11-30 23:04:30 +02:00
pycore_runtime.h gh-106931: Intern Statically Allocated Strings Globally (gh-107272) 2023-07-27 13:56:59 -06:00
pycore_runtime_init.h gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974) 2023-07-28 14:39:08 -06:00
pycore_runtime_init_generated.h gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304) 2023-07-09 15:27:03 +03:00
pycore_setobject.h gh-107211: No longer export internal functions (2) (#107214) 2023-07-25 03:49:28 +02:00
pycore_signal.h gh-107211: No longer export internal functions (2) (#107214) 2023-07-25 03:49:28 +02:00
pycore_sliceobject.h GH-94163: Add BINARY_SLICE and STORE_SLICE instructions. (GH-94168) 2022-06-27 12:24:23 +01:00
pycore_strhex.h gh-91768: C API no longer use "const PyObject*" type (#91769) 2022-04-21 22:07:19 +02: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-107211: Rename PySymtable_Lookup() to _PySymtable_Lookup() (#107212) 2023-07-25 00:54:09 +00:00
pycore_sysmodule.h gh-107211: No longer export internal functions (3) (#107215) 2023-07-25 02:25:45 +00:00
pycore_time.h gh-107211: No longer export internal functions (3) (#107215) 2023-07-25 02:25:45 +00:00
pycore_token.h gh-107015: Remove async_hacks from the tokenizer (#107018) 2023-07-26 16:34:15 +01:00
pycore_traceback.h gh-107211: No longer export internal functions (3) (#107215) 2023-07-25 02:25:45 +00:00
pycore_tracemalloc.h gh-107211: No longer export internal functions (3) (#107215) 2023-07-25 02:25:45 +00:00
pycore_tuple.h gh-106320: Remove _PyTuple_MaybeUntrack() C API (#107143) 2023-07-23 19:16:21 +00:00
pycore_typeobject.h gh-107211: No longer export internal variables (#107218) 2023-07-25 03:48:04 +00:00
pycore_typevarobject.h gh-104549: Set __module__ on TypeAliasType (#104550) 2023-05-18 15:56:15 -07:00
pycore_ucnhash.h
pycore_unicodeobject.h gh-107211: No longer export internal functions (3) (#107215) 2023-07-25 02:25:45 +00:00
pycore_unicodeobject_generated.h gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304) 2023-07-09 15:27:03 +03:00
pycore_unionobject.h gh-87347: Add parenthesis around PyXXX_Check() arguments (#92815) 2022-06-16 13:49:43 +02:00
pycore_uops.h gh-106603: Make uop struct a triple (opcode, oparg, operand) (#106794) 2023-07-17 12:12:33 -07:00
pycore_warnings.h gh-107211: No longer export internal functions (3) (#107215) 2023-07-25 02:25:45 +00:00
pycore_weakref.h gh-105927: Remove _PyWeakref_GetWeakrefCount() (#106007) 2023-06-23 03:00:56 +00:00