@@ -1493,14 +1493,20 @@ Allows customizing how exceptions are handled in the event loop.
14931493 about context).
14941494
14951495 If the handler is called on behalf of a :class: `~asyncio.Task ` or
1496- :class: `~asyncio.Handle `, it is run in the
1496+ :class: `~asyncio.Handle `, it is run in a copy of the
14971497 :class: `contextvars.Context ` of that task or callback handle.
14981498
14991499 .. versionchanged :: 3.12
15001500
15011501 The handler may be called in the :class: `~contextvars.Context `
15021502 of the task or handle where the exception originated.
15031503
1504+ .. versionchanged :: next
1505+
1506+ The handler now runs in a copy of that context. Previously, reporting
1507+ an exception from inside the task's own context raised
1508+ :exc: `RuntimeError ` and the handler was skipped.
1509+
15041510.. method :: loop.get_exception_handler()
15051511
15061512 Return the current exception handler, or ``None `` if no custom
@@ -1519,6 +1525,13 @@ Allows customizing how exceptions are handled in the event loop.
15191525 *context * parameter has the same meaning as in
15201526 :meth: `call_exception_handler `.
15211527
1528+ .. versionchanged :: next
1529+
1530+ When no exception handler is set, :meth: `call_exception_handler `
1531+ runs this method in a copy of the :class: `contextvars.Context ` of
1532+ the task or handle where the exception originated, as for a custom
1533+ handler.
1534+
15221535.. method :: loop.call_exception_handler(context)
15231536
15241537 Call the current event loop exception handler.
0 commit comments