Skip to content

Commit 9f07a85

Browse files
committed
Make documentation more concise
1 parent ff8c23e commit 9f07a85

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

docs/advanced/exceptions.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Registering custom translators
7575

7676
If the default exception conversion policy described above is insufficient,
7777
pybind11 also provides support for registering custom exception translators.
78+
7879
Similar to pybind11 classes, exception translators can be local to the module
7980
they are defined in or global to the entire python session. To register a simple
8081
exception conversion that translates a C++ exception into a new Python exception
@@ -101,7 +102,6 @@ parameter, a `handle`:
101102
.. code-block:: cpp
102103
103104
py::register_exception<CppExp>(module, "PyExp", PyExc_RuntimeError);
104-
py::register_local_exception<CppExp>(module, "PyExp", PyExc_RuntimeError);
105105
106106
Then `PyExp` can be caught both as `PyExp` and `RuntimeError`.
107107

@@ -178,10 +178,9 @@ section.
178178
Local vs Global Exception Translators
179179
=====================================
180180

181-
Similar to how the ``py::module_local`` flag allows uesrs to limit a bound class
182-
to a single compiled module to prevent name collisions. When a global exception
183-
translator is registered, it will be applied across all modules in the reverse
184-
order of registration. This can create behavior where the order of module import
181+
When a global exception translator is registered, it will be applied across all
182+
modules in the reverse order of registration. When there are multiple pybind11
183+
modules being loaded, this can create behavior where the order of module import
185184
influences how exceptions are translated.
186185

187186
If module1 has the following translator:
@@ -210,7 +209,7 @@ and module2 has the following similar translator:
210209
211210
then which translator handles the invalid_argument will be determined by the
212211
order that module1 and module2 are imported. Since exception translators are
213-
applied in the reverse order of registration, which ever module was imported
212+
applied in the reverse order of registration, whichever module was imported
214213
last will "win" and that translator will be applied.
215214

216215
If there are multiple pybind11 modules that share exception types (either

0 commit comments

Comments
 (0)