cpython/Lib/test/test_free_threading
Neil Schemenauer d687900f98
gh-128384: Use a context variable for warnings.catch_warnings (gh-130010)
Make `warnings.catch_warnings()` use a context variable for holding
the warning filtering state if the `sys.flags.context_aware_warnings`
flag is set to true.  This makes using the context manager thread-safe in
multi-threaded programs.

Add the `sys.flags.thread_inherit_context` flag.  If true, starting a new
thread with `threading.Thread` will use a copy of the context
from the caller of `Thread.start()`.

Both these flags are set to true by default for the free-threaded build
and false for the default build.

Move the Python implementation of warnings.py into _py_warnings.py.

Make _contextvars a builtin module.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-04-09 16:18:54 -07:00
..
__init__.py gh-120659: Skip `test_freethreading` with GIL (#120660) 2024-06-18 15:56:20 +02:00
test_code.py gh-127020: Make `PyCode_GetCode` thread-safe for free threading (#127043) 2024-11-21 11:00:50 -05:00
test_dict.py gh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064) 2025-03-26 12:08:20 -04:00
test_enumerate.py gh-121464: Make concurrent iteration over enumerate safe under free-threading (#125734) 2025-03-14 00:14:05 +05:30
test_func_annotations.py gh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064) 2025-03-26 12:08:20 -04:00
test_gc.py gh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064) 2025-03-26 12:08:20 -04:00
test_iteration.py gh-115999: Make list and tuple iteration more thread-safe. (#128637) 2025-02-18 16:52:46 -08:00
test_itertools_batched.py gh-131152: Remove unused imports from tests (part 2) (#131154) 2025-03-13 10:57:40 +01:00
test_list.py gh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064) 2025-03-26 12:08:20 -04:00
test_methodcaller.py gh-131152: Remove unused imports from tests (part 2) (#131154) 2025-03-13 10:57:40 +01:00
test_monitoring.py gh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064) 2025-03-26 12:08:20 -04:00
test_races.py gh-128384: Use a context variable for warnings.catch_warnings (gh-130010) 2025-04-09 16:18:54 -07:00
test_reversed.py gh-120608: Make reversed iterator work with free-threading (#120971) 2025-03-12 12:39:52 +01:00
test_set.py gh-129967: Fix race condition in `repr(set)` (gh-129978) 2025-02-11 17:29:27 -05:00
test_slots.py gh-117657: TSAN Fix races in `PyMember_Get` and `PyMember_Set` for C extensions (GH-123211) 2024-12-03 09:41:53 -05:00
test_str.py gh-120417: Remove unused imports in tests (part 2) (#120630) 2024-06-17 21:05:37 +02:00
test_tokenize.py gh-120317: Lock around global state in the tokenize module (#120318) 2024-07-16 11:35:57 +02:00
test_type.py gh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064) 2025-03-26 12:08:20 -04:00
test_zip.py gh-123271: Make builtin zip method safe under free-threading (#123272) 2024-08-27 15:22:43 -04:00