Skip to content

Commit 44d5bc3

Browse files
committed
Fixing rst inline literals and links
1 parent 07db204 commit 44d5bc3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/advanced/pycpp/utilities.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ Executing code in a Python `with` statement
2525
===========================================
2626

2727
Where in C++, the scope of local variables and their destructor is used to manage
28-
resources in the RAII idiom, Python has a `with` statement and context managers
29-
for such situations. At the start and end of the `with` statement, the context
30-
manager's `__enter__` and `__exit__` methods are called, respectively. To more
28+
resources in the RAII idiom, Python has a ``with`` statement and context managers
29+
for such situations. At the start and end of the ``with`` statement, the context
30+
manager's ``__enter__`` and ``__exit__`` methods are called, respectively. To more
3131
easily use context managers in a C++ context, pybind11 provides a utility function
32-
``py::with``, that matches the semantics of a Python `with`-statement (see
32+
`py::with <with>`, that matches the semantics of a Python ``with``-statement (see
3333
`PEP 343 <https://www.python.org/dev/peps/pep-0343/>`_):
3434

3535
.. code-block:: cpp
@@ -53,13 +53,13 @@ This code snippet corresponds to the following in Python:
5353
f.write("\n")
5454
5555
The `py::object` parameter of the lambda function can be omitted if the object resulting
56-
from the context manager (i.e., the `as VAR` part in the `with` statement) is not of use.
56+
from the context manager (i.e., the ``as VAR`` part in the ``with`` statement) is not of use.
5757

58-
Optionally, an extra `py::with_exception_policy` argument can be passed to `py::with`.
59-
If the value `py::with_exception_policy::translate` is selected, pybind11 will try to
60-
translate any C++ exception inside the `with` statement and pass the Python exception
61-
as argument into the `__exit__` method of the context manager (cfr. PEP 343). If
62-
`py::with_exception_policy::translate` is passed and an exception gets thrown, pybind11
58+
Optionally, an extra `py::with_exception_policy <with_exception_policy>` argument can be
59+
passed to `py::with <with>`. If the value ``py::with_exception_policy::translate`` is selected,
60+
pybind11 will try to translate any C++ exception inside the ``with`` statement and pass the
61+
Python exception as argument into the ``__exit__`` method of the context manager (cfr. PEP 343).
62+
If ``py::with_exception_policy::translate`` is passed and an exception gets thrown, pybind11
6363
will not try to translate it, `__exit__` will be called as if no exception was thrown,
6464
and the original exception will be cascaded down to the caller.
6565

0 commit comments

Comments
 (0)