diff options
author | Kirill Podoprigora <kirill.bast9@mail.ru> | 2024-10-15 14:42:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-15 14:42:16 (GMT) |
commit | d3c82b9ccedd77fc302f5ab8ab0220b3372f574c (patch) | |
tree | ee15c5f380dadeac8ee875abbc73b20f8067a12e /Include/cpython/context.h | |
parent | 55c4f4c30b49734ce35dc88139b8b4fdc94c66fd (diff) | |
download | cpython-d3c82b9ccedd77fc302f5ab8ab0220b3372f574c.zip cpython-d3c82b9ccedd77fc302f5ab8ab0220b3372f574c.tar.gz cpython-d3c82b9ccedd77fc302f5ab8ab0220b3372f574c.tar.bz2 |
gh-125512: Revert "gh-124872: Replace enter/exit events with "switched" (#124776)" (#125513)
Diffstat (limited to 'Include/cpython/context.h')
-rw-r--r-- | Include/cpython/context.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Include/cpython/context.h b/Include/cpython/context.h index 3a7a4b4..3c9be78 100644 --- a/Include/cpython/context.h +++ b/Include/cpython/context.h @@ -29,11 +29,20 @@ PyAPI_FUNC(int) PyContext_Exit(PyObject *); typedef enum { /* - * The current context has switched to a different context. The object - * passed to the watch callback is the now-current contextvars.Context - * object, or None if no context is current. + * A context has been entered, causing the "current context" to switch to + * it. The object passed to the watch callback is the now-current + * contextvars.Context object. Each enter event will eventually have a + * corresponding exit event for the same context object after any + * subsequently entered contexts have themselves been exited. */ - Py_CONTEXT_SWITCHED = 1, + Py_CONTEXT_EVENT_ENTER, + /* + * A context is about to be exited, which will cause the "current context" + * to switch back to what it was before the context was entered. The + * object passed to the watch callback is the still-current + * contextvars.Context object. + */ + Py_CONTEXT_EVENT_EXIT, } PyContextEvent; /* |