cpython/Doc/c-api
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
..
abstract.rst
allocation.rst
apiabiversion.rst
arg.rst
bool.rst
buffer.rst
bytearray.rst
bytes.rst
call.rst
capsule.rst
cell.rst
code.rst gh-70870: Clarify dual usage of 'free variable' (#122545) 2024-10-08 07:52:12 +00:00
codec.rst
complex.rst
concrete.rst
contextvars.rst gh-124872: Replace enter/exit events with "switched" (#125532) 2024-10-16 13:53:21 +02:00
conversion.rst
coro.rst
datetime.rst
descriptor.rst
dict.rst
exceptions.rst gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) 2024-09-25 19:29:58 +00:00
file.rst
float.rst
frame.rst
function.rst
gcsupport.rst
gen.rst
hash.rst
import.rst gh-101100: Consolidate documentation on ModuleType attributes (#124709) 2024-10-09 10:53:57 +00:00
index.rst
init.rst Python 3.14.0a1 2024-10-15 22:34:54 +03:00
init_config.rst gh-125517: Fix unreachable code warnings in _testembed.c (#125518) 2024-10-15 13:12:32 +00:00
intro.rst
iter.rst
iterator.rst
list.rst
long.rst Python 3.14.0a1 2024-10-15 22:34:54 +03:00
mapping.rst
marshal.rst
memory.rst
memoryview.rst
method.rst
module.rst gh-101100: Consolidate documentation on ModuleType attributes (#124709) 2024-10-09 10:53:57 +00:00
monitoring.rst
none.rst
number.rst
object.rst gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) 2024-09-25 19:29:58 +00:00
objimpl.rst
perfmaps.rst
refcounting.rst
reflection.rst
sequence.rst
set.rst
slice.rst
stable.rst
structures.rst
sys.rst
time.rst
tuple.rst gh-124182: Explain naming rules for struct sequence types (#124335) 2024-10-07 19:52:34 +02:00
type.rst gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) 2024-09-25 19:29:58 +00:00
typehints.rst
typeobj.rst gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) 2024-09-25 19:29:58 +00:00
unicode.rst Python 3.14.0a1 2024-10-15 22:34:54 +03:00
utilities.rst
veryhigh.rst bpo-34206: Improve docs and test coverage for pre-init functions (#8023) 2024-10-08 08:34:11 +00:00
weakref.rst