cpython/Lib/test/test_capi
Eric Snow 81865002ae
gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331)
_PyArg_Parser holds static global data generated for modules by Argument Clinic.  The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global.  In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters.  However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed.

This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes.  It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime.  The solution here is to temporarily switch to the main interpreter.  The alternative would be to always statically allocate the tuple.

This change also fixes a bug where only the most recent parser was added to the global linked list.
2024-05-22 09:57:52 -06:00
..
__init__.py gh-116303: Skip test module dependent tests if test modules are unavailable (#117341) 2024-04-03 15:11:36 +02:00
__main__.py
check_config.py gh-104621: Check for Incompatible Extensions in import_find_extension() (gh-107184) 2023-07-27 15:08:38 -06:00
test_abstract.py gh-113024: C API: Add PyObject_GenericHash() function (GH-113025) 2024-03-22 20:19:10 +02:00
test_bytearray.py gh-116417: Move 4 limited C API test files to _testlimitedcapi (#116571) 2024-03-11 10:28:16 +00:00
test_bytes.py gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160) 2024-03-25 16:32:11 +01:00
test_codecs.py gh-116417: Move limited C API unicode.c tests to _testlimitedcapi (#116993) 2024-03-19 12:30:39 +00:00
test_complex.py gh-116417: Move limited C API complex.c tests to _testlimitedcapi (#117014) 2024-03-19 17:23:12 +01:00
test_dict.py gh-115142: Skip ``test_capi.test_dict.py`` if ``_testcapi`` and ``_testlimitedcapi`` are not available (GH-117588) 2024-04-10 16:32:57 +02:00
test_eval_code_ex.py gh-117694: Improve tests for PyEval_EvalCodeEx() (GH-117695) 2024-04-15 12:44:54 +03:00
test_exceptions.py gh-119049: Fix incorrect display of warning which is constructed by C API (GH-119063) 2024-05-16 20:27:59 +00:00
test_float.py gh-116417: Move limited C API abstract.c tests to _testlimitedcapi (#116986) 2024-03-19 10:44:13 +00:00
test_getargs.py gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) 2024-05-22 09:57:52 -06:00
test_hash.py gh-111545: Add Py_HashPointer() function (#112096) 2023-12-06 15:09:22 +01:00
test_immortal.py gh-84436: Add integration C API tests for immortal objects (gh-103962) 2023-05-03 00:05:30 +09:00
test_list.py gh-116417: Move limited C API list.c tests to _testlimitedcapi (#116602) 2024-03-18 22:03:55 +01:00
test_long.py gh-111140: PyLong_From/AsNativeBytes: Take *flags* rather than just *endianness* (GH-116053) 2024-04-05 16:21:16 +02:00
test_mem.py Fix incorrect usage of ``support.requires_gil_enabled`` (#118170) 2024-04-25 11:11:59 -04:00
test_misc.py gh-118846: Fix free-threading test failures when run sequentially (#118864) 2024-05-10 16:29:29 -04:00
test_object.py gh-94808:Improve coverage of PyObject_Print (GH-98749) 2024-04-01 12:52:25 +00:00
test_opt.py GH-115709: Invalidate executors when a local variable is changed via frame.f_locals (#118639) 2024-05-06 21:21:06 +00:00
test_pyatomic.py gh-108337: Add pyatomic.h header (#108701) 2023-08-31 21:41:18 +00:00
test_run.py gh-116180: Check the globals argument in PyRun_* C API (GH-116637) 2024-05-02 16:43:03 +03:00
test_set.py gh-116417: Move limited C API list.c tests to _testlimitedcapi (#116602) 2024-03-18 22:03:55 +01:00
test_structmembers.py gh-115011: Improve support of __index__() in setters of members with unsigned integer type (GH-115029) 2024-02-11 12:45:58 +02:00
test_sys.py gh-116417: Move 4 limited C API test files to _testlimitedcapi (#116571) 2024-03-11 10:28:16 +00:00
test_time.py gh-110850: Add PyTime_TimeRaw() function (#118394) 2024-05-01 18:05:01 +00:00
test_unicode.py gh-117642: Fix PEP 737 implementation (GH-117643) 2024-04-08 16:27:25 +00:00
test_watchers.py gh-117783: Immortalize objects that use deferred reference counting (#118112) 2024-04-29 14:36:02 -04:00