Skip to content

Commit ffa8cc8

Browse files
committed
fixup! pythongh-119333: Back up exception before calling PyContext_WatchCallback
1 parent 66fdcf5 commit ffa8cc8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Doc/c-api/contextvars.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ Context object management functions:
135135
Otherwise, the callback is invoked before the deactivation of *ctx* as the current context
136136
and the restoration of the previous contex object for the current thread.
137137
138-
If the callback raises an exception it will be ignored.
139-
140138
Any pending exception is cleared before the callback is called and restored
141139
after the callback returns.
142140
141+
If the callback raises an exception it will be ignored.
142+
143143
.. versionadded:: 3.14
144144
145145

Include/cpython/context.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ typedef enum {
3838
* The callback is invoked with the event and a reference to
3939
* the context after its entered and before its exited.
4040
*
41-
* If the callback raises an exception it will be ignored.
42-
*
4341
* Any pending exception is cleared before the callback is called and restored
4442
* after the callback returns.
43+
*
44+
* If the callback raises an exception it will be ignored.
4545
*/
4646
typedef void (*PyContext_WatchCallback)(PyContextEvent, PyContext *);
4747

0 commit comments

Comments
 (0)