1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= python-exceptiongroup
7 SDESC[py310]= Backport of PEP 654 (exception groups) (3.10)
8 SDESC[v11]= Backport of PEP 654 (exception groups) (3.11)
10 CONTACT= Python_Automaton[python@ironwolf.systems]
13 SITES[main]= PYPIWHL/e8/14/9c6a7e5f12294ccd6975a45e02899ed25468cd7c2c86f3d9725f387f9f5f
14 DISTFILE[1]= exceptiongroup-1.1.0-py3-none-any.whl:main
19 OPTIONS_AVAILABLE= PY310 PY311
20 OPTIONS_STANDARD= none
21 VOPTS[py310]= PY310=ON PY311=OFF
22 VOPTS[v11]= PY310=OFF PY311=ON
24 DISTNAME= exceptiongroup-1.1.0.dist-info
28 [PY310].USES_ON= python:py310,wheel
30 [PY311].USES_ON= python:v11,wheel
32 [FILE:3080:descriptions/desc.single]
36 This is a backport of the BaseExceptionGroup and ExceptionGroup classes
40 It contains the following:
42 * The ``exceptiongroup.BaseExceptionGroup and
43 exceptiongroup.ExceptionGroup``
45 * A utility function (``exceptiongroup.catch()``) for catching exceptions
47 nested in an exception group
48 * Patches to the TracebackException class that properly formats exception
51 * An exception hook that handles formatting of exception groups through
52 TracebackException (installed on import)
53 * Special versions of some of the functions from the traceback module,
55 correctly handle exception groups even when monkey patching is disabled,
57 another custom exception hook:
59 * ``traceback.format_exception()``
60 * ``traceback.format_exception_only()``
61 * ``traceback.print_exception()``
62 * ``traceback.print_exc()``
64 If this package is imported on Python 3.11 or later, the built-in
65 implementations of the
66 exception group classes are used instead, TracebackException is not monkey
68 and the exception hook won't be installed.
70 See the `standard library documentation`_ for more information on exception
73 .. _standard library documentation:
74 https://docs.python.org/3/library/exceptions.html
79 Due to the lack of the ``except*`` syntax introduced by `PEP 654`_ in
81 versions, you need to use ``exceptiongroup.catch()`` to catch exceptions
83 potentially nested inside an exception group. This function returns a
85 that calls the given handler for any exceptions matching the sole argument.
87 The argument to ``catch()`` must be a dict (or any Mapping) where each key
89 an exception class or an iterable of exception classes. Each value must be
91 that takes a single positional argument. The handler will be called at most
93 an exception group as an argument which will contain all the exceptions
95 of the given types, or their subclasses. The exception group may contain
97 containing more matching exceptions.
99 Thus, the following Python 3.11+ code:
101 .. code-block:: python3
105 except* (ValueError, KeyError) as excgroup:
106 for exc in excgroup.exceptions:
107 print('Caught exception:', type(exc))
108 except* RuntimeError:
109 print('Caught runtime error')
111 would be written with this backport like this:
113 .. code-block:: python3
115 from exceptiongroup import ExceptionGroup, catch
117 def value_key_err_handler(excgroup: ExceptionGroup) -> None:
118 for exc in excgroup.exceptions:
119 print('Caught exception:', type(exc))
121 def runtime_err_handler(exc: ExceptionGroup) -> None:
122 print('Caught runtime error')
125 (ValueError, KeyError): value_key_err_handler,
126 RuntimeError: runtime_err_handler
130 **NOTE**: Just like with ``except*``, you cannot handle BaseExceptionGroup
132 ExceptionGroup with ``catch()``.
136 327cbda3da756e2de031a3107b81ab7b3770a602c4d16ca618298c526f4bec1e 14263 exceptiongroup-1.1.0-py3-none-any.whl