Skip to content

Commit a3d516b

Browse files
authored
Merge pull request #19041 from anntzer/eh
Reword docs for exception_handler in CallbackRegistry.
2 parents f04cf57 + fc70bfa commit a3d516b

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

lib/matplotlib/cbook/__init__.py

+8-14
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,14 @@ class CallbackRegistry:
138138
Parameters
139139
----------
140140
exception_handler : callable, optional
141-
If provided must have signature ::
142-
143-
def handler(exc: Exception) -> None:
144-
145-
If not None this function will be called with any `Exception`
146-
subclass raised by the callbacks in `CallbackRegistry.process`.
147-
The handler may either consume the exception or re-raise.
148-
149-
The callable must be pickle-able.
150-
151-
The default handler is ::
152-
153-
def h(exc):
154-
traceback.print_exc()
141+
If not None, *exception_handler* must be a function that takes an
142+
`Exception` as single parameter. It gets called with any `Exception`
143+
raised by the callbacks during `CallbackRegistry.process`, and may
144+
either re-raise the exception or handle it in another manner.
145+
146+
The default handler prints the exception (with `traceback.print_exc`) if
147+
an interactive event loop is running; it re-raises the exception if no
148+
interactive event loop is running.
155149
"""
156150

157151
# We maintain two mappings:

0 commit comments

Comments
 (0)