cpython/Lib/test/test_capi
Kirill Podoprigora bee112a94d
gh-124872: Replace enter/exit events with "switched" (#125532)
Users want to know when the current context switches to a different
context object.  Right now this happens when and only when a context
is entered or exited, so the enter and exit events are synonymous with
"switched".  However, if the changes proposed for gh-99633 are
implemented, the current context will also switch for reasons other
than context enter or exit.  Since users actually care about context
switches and not enter or exit, replace the enter and exit events with
a single switched event.

The former exit event was emitted just before exiting the context.
The new switched event is emitted after the context is exited to match
the semantics users expect of an event with a past-tense name.  If
users need the ability to clean up before the switch takes effect,
another event type can be added in the future.  It is not added here
because YAGNI.

I skipped 0 in the enum as a matter of practice.  Skipping 0 makes it
easier to troubleshoot when code forgets to set zeroed memory, and it
aligns with best practices for other tools (e.g.,
https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum).

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-10-16 13:53:21 +02: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-120417: Add #noqa: F401 to tests (#120627) 2024-06-18 15:51:47 +00:00
test_abstract.py gh-111495: Add tests for PyNumber C API (#111996) 2024-08-26 15:59:22 +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-121645: Add PyBytes_Join() function (#121646) 2024-08-30 12:57:33 +00:00
test_codecs.py gh-111495: Add tests for `PyCodec_*` C API (#123343) 2024-09-29 15:22:39 +00:00
test_complex.py gh-119771: Set errno on overflows in _Py_c_pow() (#120256) 2024-09-18 10:39:11 +02:00
test_config.py gh-107954: Fix configuration type for the perf profiler (#124636) 2024-09-28 01:50:16 +02: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.py gh-111495: Add more tests on PyEval C APIs (#122789) 2024-08-08 14:16:20 +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 Fix typos in comments (#123201) 2024-08-21 12:49:23 +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-121039: add Floats/ComplexesAreIdenticalMixin to test.support.testcase (GH-121071) 2024-09-08 16:01:54 +03:00
test_hash.py gh-122854: Add Py_HashBuffer() function (#122855) 2024-08-30 15:42:27 +00: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-111495: Add tests for PyTuple C API (#118757) 2024-08-26 11:57:52 +02:00
test_long.py gh-121485: Always use 64-bit integers for integers bits count (GH-121486) 2024-08-30 08:13:24 +03: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-124153: Implement `PyType_GetBaseByToken()` and `Py_tp_token` slot (GH-124163) 2024-09-18 09:18:19 +02:00
test_number.py gh-111495: Remove test_capi test_rshift_print() (#123338) 2024-08-26 14:39:32 +00:00
test_object.py gh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (#118807) 2024-06-18 09:57:23 -04:00
test_opt.py GH-122821: Simplify compilation of while statements to ensure consistency of offsets for sys.monitoring (GH-122934) 2024-08-13 10:25:44 +01: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-111495: Add tests for PyTuple C API (#118757) 2024-08-26 11:57:52 +02:00
test_structmembers.py gh-120417: Remove unused imports in tests (part 1) (#120629) 2024-06-17 21:05:56 +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-111495: Add tests for PyTuple C API (#118757) 2024-08-26 11:57:52 +02:00
test_tuple.py gh-111495: Add tests for PyTuple C API (#118757) 2024-08-26 11:57:52 +02:00
test_unicode.py gh-124502: Add PyUnicode_Equal() function (#124504) 2024-10-07 21:24:53 +00:00
test_watchers.py gh-124872: Replace enter/exit events with "switched" (#125532) 2024-10-16 13:53:21 +02:00