mirror of https://github.com/python/cpython
bee112a94d
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> |
||
---|---|---|
.. | ||
__init__.py | ||
__main__.py | ||
check_config.py | ||
test_abstract.py | ||
test_bytearray.py | ||
test_bytes.py | ||
test_codecs.py | ||
test_complex.py | ||
test_config.py | ||
test_dict.py | ||
test_eval.py | ||
test_eval_code_ex.py | ||
test_exceptions.py | ||
test_float.py | ||
test_getargs.py | ||
test_hash.py | ||
test_immortal.py | ||
test_list.py | ||
test_long.py | ||
test_mem.py | ||
test_misc.py | ||
test_number.py | ||
test_object.py | ||
test_opt.py | ||
test_pyatomic.py | ||
test_run.py | ||
test_set.py | ||
test_structmembers.py | ||
test_sys.py | ||
test_time.py | ||
test_tuple.py | ||
test_unicode.py | ||
test_watchers.py |