cpython/Modules
Gregory P. Smith 0d8fb0b852
[3.14] gh-137109: refactor warning about threads when forking (GH-141438) (GH-141614)
This splits the OS API specific functionality to get the number of threads out
from the fallback Python method and warning raising code itself.  This way the
OS APIs can be queried before we've run
`os.register_at_fork(after_in_parent=...)` registered functions which
themselves may (re)start threads that would otherwise be detected.

This is best effort.  If the OS APIs are either unavailable or fail, the
warning generating code still falls back to looking at the Python threading
state after the CPython interpreter world has been restarted and the
after_in_parent calls have been made.  The common case for most Linux and macOS
environments should work today.

This also lines up with the existing TODO refactoring, we may choose to expose
this API to get the number of OS threads in the `os` module in the future.

Note: This is a simplified backport that maintains the void return type
for warn_about_fork_with_threads() and keeps PyErr_Clear() in the warning path,
as the error handling changes from fd8f42d3d1 are not needed in 3.14.
2025-11-16 19:45:29 +00:00
..
_ctypes [3.14] Remove unreachable break statements in _ctypes_test.c (GH-140585) (#140587) 2025-10-25 18:39:42 +03:00
_decimal [3.14] gh-102431: Clarify constraints on operands of Decimal logical operations (GH-102836) (#140105) 2025-10-14 15:44:30 +02:00
_hacl [3.14] gh-140120: Refresh HACL* to fix an hmac memory leak (GH-140188) (#140192) 2025-10-16 20:53:12 -07:00
_io [3.14] gh-141314: Fix TextIOWrapper.tell() assertion failure with standalone carriage return (GH-141331) (GH-141453) 2025-11-12 12:40:02 +02:00
_multiprocessing gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_sqlite [3.14] gh-139283: correctly handle size limit in cursor.fetchmany() (GH-139296) (GH-139441) 2025-10-07 21:23:08 +02:00
_sre [3.14] gh-140979: Fix off-by-one error in the RE code validator (GH-140984) (GH-141001) 2025-11-04 18:16:51 +02:00
_ssl [3.14] gh-134698: Hold a lock when the thread state is detached in ssl (GH-134724) (GH-137107) 2025-10-07 18:49:22 +00:00
_testcapi [3.14] gh-136288: Fix error message in _testcapi/vectorcall.c (GH-136258) (GH-136294) 2025-07-04 16:18:32 +00:00
_testinternalcapi [3.14] gh-114203: skip locking if object is already locked by two-mutex critical section (GH-141476) (#141564) 2025-11-14 18:38:30 +00:00
_testlimitedcapi [3.14] gh-132657: add regression test for PySet_Contains with unhashable type (GH-141411) (#141468) 2025-11-12 15:49:09 +00:00
_xxtestfuzz gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
_zstd [3.14] gh-132983: Use `Py_UNREACHABLE in _zstd_load_impl()` (GH-137320) (#137360) 2025-08-07 18:38:15 +03:00
cjkcodecs [3.14] gh-101828: Fix jisx0213 codecs removing null characters (gh-139340) (gh-140110) 2025-10-14 14:36:05 +00:00
clinic [3.14] gh-140615: Update docstrings in the fcntl module (GH-140619) (GH-141231) 2025-11-08 11:16:45 +00:00
expat [3.14] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) (#139359) 2025-11-02 09:33:36 +00:00
_abc.c
_asynciomodule.c gh-91048: Prevent optimizing away the asyncio debug offsets structure on Windows (#132963) 2025-04-25 17:43:32 +00:00
_bisectmodule.c
_bz2module.c
_codecsmodule.c GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
_collectionsmodule.c [3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119) 2025-06-30 15:59:22 +02:00
_csv.c [3.14] gh-137986: Fix and improve the csv functions docstrings (GH-137987) (GH-138107) 2025-10-08 14:27:57 +02:00
_curses_panel.c [3.14] gh-116946: fully implement GC protocol for _curses_panel.panel (GH-138333) (#138427) 2025-09-06 21:20:35 +03:00
_cursesmodule.c [3.14] gh-137920: Fix semantically relevant typo in curses.window.attron (#137940) (GH-138506) 2025-10-07 22:21:41 +02:00
_datetimemodule.c [3.14] gh-139774: use relaxed atomics for datetime hashes (GH-139775) (#139780) 2025-10-08 21:09:09 +05:30
_dbmmodule.c [3.14] gh-116738: Add critical section to dbm/gdbm context manager (gh-140391) (gh-140459) 2025-10-22 15:44:09 +00:00
_elementtree.c [3.14] gh-140061: Use _PyObject_IsUniquelyReferenced() to check if objects are uniquely referenced (gh-140062) (gh-140157) 2025-10-15 14:49:17 +00:00
_functoolsmodule.c [3.14] GH-140590: Fix setstate for functools.partial C-module (GH-140671) (#140698) 2025-10-28 18:15:27 +05:30
_gdbmmodule.c [3.14] gh-116738: Add critical section to dbm/gdbm context manager (gh-140391) (gh-140459) 2025-10-22 15:44:09 +00:00
_hashopenssl.c [3.14] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134961) 2025-06-01 10:26:56 +02:00
_heapqmodule.c [3.14] Fix comments for heapq.siftup_max (GH-135359) (#136232) 2025-07-03 10:17:10 +00:00
_interpchannelsmodule.c [3.14] gh-140306: Fix memory leaks in cross-interpreter data handling (GH-140307) (GH-140338) 2025-10-19 19:53:36 +00:00
_interpqueuesmodule.c [3.14] gh-140306: Fix memory leaks in cross-interpreter data handling (GH-140307) (GH-140338) 2025-10-19 19:53:36 +00:00
_interpreters_common.h [3.14] gh-132775: Use _PyObject_GetXIData (With Fallback) (gh-134507) 2025-05-22 07:21:05 -06:00
_interpretersmodule.c [3.14] Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (GH-136991) (#137006) 2025-07-22 19:16:31 +03:00
_json.c [3.14] Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (GH-136991) (#137006) 2025-07-22 19:16:31 +03:00
_localemodule.c [3.14] gh-60462: Fix locale.strxfrm() on Solaris (GH-138242) (GH-138448) 2025-10-08 14:34:51 +02:00
_lsprof.c [3.14] gh-116738: make cProfile module thread-safe (GH-138229) (#138575) 2025-10-07 18:51:22 +00:00
_lzmamodule.c [3.14] gh-133583: Add support for fixed size unsigned integers in argument parsing (GH-133584) (GH-133650) 2025-05-08 09:54:44 +00:00
_math.h
_opcode.c [3.14] gh-135755: Move SPECIAL_ constants to a private header (GH-135922) (GH-135926) 2025-06-25 13:36:46 +02:00
_operator.c gh-131238: Add explicit includes to pycore headers (#131257) 2025-03-17 12:32:43 +01:00
_pickle.c [3.14] gh-135321: Always raise a correct exception for BINSTRING argument > 0x7fffffff in pickle (GH-135322) (GH-135382) 2025-06-11 14:01:15 +03:00
_posixsubprocess.c [3.14] fix comment reference from man 7 signal to man 7 signal-safety (GH-138554) (#138594) 2025-10-07 19:34:15 +01:00
_queuemodule.c [3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119) 2025-06-30 15:59:22 +02:00
_randommodule.c [3.14] Fix a compiler warning in _randommodule.c (GH-141058) (#141063) 2025-11-05 19:10:32 +00:00
_remote_debugging_module.c [3.14] Fix compiler warnings in remote debugging (#141060) (#141067) 2025-11-05 19:49:39 +00:00
_scproxy.c
_ssl.c [3.14] gh-139929: fix incorrect OpenSSL version-based guard in _ssl.c (GH-139945) (#139964) 2025-10-11 17:59:55 +00:00
_ssl.h
_ssl_data_35.h [3.14] gh-139573: Update OpenSSL in CI (GH-139577) (#139583) 2025-10-05 07:50:26 +03:00
_ssl_data_111.h gh-131423: Update OpenSSL data to 3.4.1 on Linux (#131618) 2025-04-25 10:26:58 +02:00
_ssl_data_300.h
_ssl_data_340.h gh-131423: Update OpenSSL data to 3.4.1 on Linux (#131618) 2025-04-25 10:26:58 +02:00
_stat.c [3.14] gh-108765: fix comment about macro definitions in _stat.c post GH-108854 (GH-136027) (#136043) 2025-06-27 15:40:34 +00:00
_statisticsmodule.c
_struct.c [3.14] gh-140260: fix data race in _struct module initialization with subinterpreters (GH-140909) (#141501) 2025-11-13 17:23:22 +05:30
_suggestions.c gh-131936: Strengthen check in _suggestions._generate_suggestions (#131945) 2025-03-31 19:30:29 +02:00
_sysconfig.c gh-127405: Add ABIFLAGS to sysconfig variables on Windows (GH-131799) 2025-04-11 16:19:03 +01:00
_testbuffer.c gh-111178: fix UBSan failures for Modules/_testbuffer.c (#131612) 2025-03-24 10:46:25 +01:00
_testcapi_feature_macros.inc
_testcapimodule.c [3.14] gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899) (#136969) 2025-07-22 12:44:59 +03:00
_testclinic.c gh-132753: Argument Clinic: Fix support of c_default for the bool converter (GH-132754) 2025-04-20 23:21:29 +00:00
_testclinic_limited.c
_testimportmultiple.c
_testinternalcapi.c [3.14] gh-139525: Don't specialize functions which have a modified vectorcall (GH-139524) (#139709) 2025-10-08 09:13:34 -07:00
_testlimitedcapi.c
_testmultiphase.c gh-111178: fix UBSan failures for Modules/_testmultiphase.c (#131615) 2025-03-24 10:59:30 +01:00
_testsinglephase.c
_threadmodule.c [3.14] gh-138004: Fix setting a thread name on OpenIndiana (GH-138017) (#138384) 2025-10-07 20:58:35 +02:00
_tkinter.c [3.14] gh-124111: Fix TCL 9 thread detection (GH-141482) 2025-11-12 22:43:31 +00:00
_tracemalloc.c
_typesmodule.c GH-118761: Expose more core interpreter types in `_types` (#132103) 2025-04-05 18:11:07 +00:00
_typingmodule.c
_uuidmodule.c [3.14] gh-132710: only use stable _uuid.generate_time_safe() to deduce MAC address (GH-132901) (#134697) 2025-05-26 10:45:36 +00:00
_weakref.c
_winapi.c GH-131296: Fix incompatible pointer type warning in _winapi.c (GH-131600) 2025-03-31 17:33:55 +01:00
_zoneinfo.c [3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119) 2025-06-30 15:59:22 +02:00
addrinfo.h gh-114917: add support for AI_NUMERICSERV in getaddrinfo emulation (#114918) 2025-03-18 11:26:51 +01:00
arraymodule.c [3.14] gh-140474: Fix memory leak in array.array (GH-140478) (GH-140498) 2025-10-23 10:20:16 +00:00
atexitmodule.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
binascii.c
blake2module.c [3.14] gh-135755: rename undocumented HACL_CAN_COMPILE_SIMD{128,256} macros (GH-135847) (#136045) 2025-06-28 10:05:58 +02:00
cmathmodule.c
config.c.in gh-128384: Use a context variable for warnings.catch_warnings (gh-130010) 2025-04-09 16:18:54 -07:00
errnomodule.c
faulthandler.c [3.14] gh-137185: Fix _Py_DumpStack() async signal safety (gh-137187) (gh-137206) 2025-10-07 18:11:46 +00:00
fcntlmodule.c [3.14] gh-140615: Update docstrings in the fcntl module (GH-140619) (GH-141231) 2025-11-08 11:16:45 +00:00
gc_weakref.txt
gcmodule.c [3.14] gh-138659: Typo in the gc module docstring (GH-138660) (#138662) 2025-09-08 14:41:34 +00:00
getaddrinfo.c gh-114917: Fix typo in getaddrinfo emulation (#131413) 2025-03-18 14:31:13 +01:00
getbuildinfo.c
getnameinfo.c Replace K&R function declarations with ANSI declarations (#114818) 2025-03-11 13:06:36 +01:00
getpath.c GH-131296: Avoid invalid signed char comparison in getpath.c assertion (GH-131594) 2025-04-22 14:06:30 +01:00
getpath.py [3.14] gh-135773: have pyvenv.cfg without home key anchor a venv and deduce home (GH-135831) (#136287) 2025-07-05 00:36:12 +10:00
getpath_noop.c
grpmodule.c [3.14] gh-116738: Make grp module thread-safe (GH-135434) (#136658) 2025-07-15 11:03:33 +05:30
hashlib.h [3.14] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134961) 2025-06-01 10:26:56 +02:00
hmacmodule.c [3.14] gh-135755: rename undocumented HACL_CAN_COMPILE_SIMD{128,256} macros (GH-135847) (#136045) 2025-06-28 10:05:58 +02:00
itertoolsmodule.c [3.14] gh-140061: Use _PyObject_IsUniquelyReferenced() to check if objects are uniquely referenced (gh-140062) (gh-140157) 2025-10-15 14:49:17 +00:00
ld_so_aix.in
main.c [3.14] gh-127960 Fix the REPL to set the correct namespace by setting the correct __main__ module (gh-134275) (gh-134473) 2025-05-22 03:33:35 +02:00
makesetup gh-131298: eliminate HACL* static libraries for cryptographic modules (GH-132438) 2025-04-20 17:40:17 +00:00
makexp_aix
mathmodule.c [3.14] gh-132876: workaround broken ldexp() on Windows 10 (GH-133135) (#134684) 2025-05-25 22:23:45 -05:00
md5module.c [3.14] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134961) 2025-06-01 10:26:56 +02:00
mmapmodule.c [3.14] gh-116738: make mmap module thread-safe (GH-139237) (#139825) 2025-10-09 20:19:03 +05:30
overlapped.c GH-131296: Remove unused variable from overlapped.c (GH-131590) 2025-04-16 22:44:57 +01:00
posixmodule.c [3.14] gh-137109: refactor warning about threads when forking (GH-141438) (GH-141614) 2025-11-16 19:45:29 +00:00
posixmodule.h
pwdmodule.c
pyexpat.c [3.14] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) (#139359) 2025-11-02 09:33:36 +00:00
readline.c [3.14] gh-140398: fix memory leaks in readline module when PySys_Audit fails (GH-140400) (#140403) 2025-10-21 08:20:14 +00:00
README
resource.c [3.14] gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338) (#137506) 2025-10-07 20:43:12 +02:00
rotatingtree.c
rotatingtree.h
selectmodule.c gh-132987: Support __index__() in the select.kqueue_event constructor (GH-133094) 2025-04-29 13:55:14 +00:00
Setup GH-132983: Build `_zstd` on Windows (#133366) 2025-05-06 00:58:47 +01:00
Setup.bootstrap.in [3.14] gh-136421: Load _datetime static types during interpreter initialization (GH-136583) (GH-136943) 2025-07-21 19:23:05 -04:00
Setup.stdlib.in [3.14] gh-136421: Load _datetime static types during interpreter initialization (GH-136583) (GH-136943) 2025-07-21 19:23:05 -04:00
sha1module.c [3.14] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134961) 2025-06-01 10:26:56 +02:00
sha2module.c [3.14] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134961) 2025-06-01 10:26:56 +02:00
sha3module.c [3.14] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134961) 2025-06-01 10:26:56 +02:00
signalmodule.c [3.14] gh-137490: Fix signal.sigwaitinfo() on NetBSD (GH-137523) (GH-138935) 2025-10-08 14:33:30 +02:00
socketmodule.c [3.14] gh-100218: correctly set errno when socket.if_{nametoindex,indextoname} raise OSError (GH-140905) (#141284) 2025-11-09 13:11:43 +00:00
socketmodule.h gh-132429: Fix support of Bluetooth sockets on NetBSD and DragonFly BSD (GH-132431) 2025-04-12 23:57:34 +03:00
symtablemodule.c [3.14] gh-139748: fix leaks in AC error paths when using unicode FS-b… (#139789) 2025-10-08 22:16:21 +05:30
syslogmodule.c
termios.c
timemodule.c
tkappinit.c
tkinter.h
unicodedata.c
unicodedata_db.h
unicodename_db.h
winreparse.h
xxlimited.c [3.14] gh-134160: Add more comments for the xxlimited module (GH-140214) (GH-140664) 2025-10-28 10:24:11 +01:00
xxlimited_35.c gh-111178: Fix function signatures for multiple tests (#131496) 2025-03-20 12:27:03 +01:00
xxmodule.c gh-122040: reword Modules/xxmodule.c module-level comment (#132201) 2025-04-07 08:03:03 +00:00
xxsubtype.c
zlibmodule.c [3.14] gh-116946: fully implement GC protocol for zlib objects (GH-138290) (#138327) 2025-09-12 16:22:33 +03:00

Source files for standard library extension modules,
and former extension modules that are now builtin modules.