mirror of
https://github.com/python/cpython.git
synced 2024-11-24 00:38:00 +01:00
843d28f59d
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). |
||
---|---|---|
.. | ||
abstract.rst | ||
allocation.rst | ||
apiabiversion.rst | ||
arg.rst | ||
bool.rst | ||
buffer.rst | ||
bytearray.rst | ||
bytes.rst | ||
call.rst | ||
capsule.rst | ||
cell.rst | ||
code.rst | ||
codec.rst | ||
complex.rst | ||
concrete.rst | ||
contextvars.rst | ||
conversion.rst | ||
coro.rst | ||
datetime.rst | ||
descriptor.rst | ||
dict.rst | ||
exceptions.rst | ||
file.rst | ||
float.rst | ||
frame.rst | ||
function.rst | ||
gcsupport.rst | ||
gen.rst | ||
hash.rst | ||
import.rst | ||
index.rst | ||
init_config.rst | ||
init.rst | ||
intro.rst | ||
iter.rst | ||
iterator.rst | ||
list.rst | ||
long.rst | ||
mapping.rst | ||
marshal.rst | ||
memory.rst | ||
memoryview.rst | ||
method.rst | ||
module.rst | ||
monitoring.rst | ||
none.rst | ||
number.rst | ||
object.rst | ||
objimpl.rst | ||
perfmaps.rst | ||
refcounting.rst | ||
reflection.rst | ||
sequence.rst | ||
set.rst | ||
slice.rst | ||
stable.rst | ||
structures.rst | ||
sys.rst | ||
time.rst | ||
tuple.rst | ||
type.rst | ||
typehints.rst | ||
typeobj.rst | ||
unicode.rst | ||
utilities.rst | ||
veryhigh.rst | ||
weakref.rst |