Skip to content

Commit 60b7eb4

Browse files
committed
Manual rst-endrst fixups, based on rwgk/pybind11_scons@fa4ffb4
1 parent e379d5d commit 60b7eb4

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

include/pybind11/iostream.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ PYBIND11_NAMESPACE_END(detail)
147147
.. code-block:: cpp
148148
149149
{
150-
py::scoped_ostream_redirect output{std::cerr,
151-
py::module::import("sys").attr("stderr")}; std::cout << "Hello, World!";
150+
py::scoped_ostream_redirect output{std::cerr, py::module::import("sys").attr("stderr")};
151+
std::cout << "Hello, World!";
152152
}
153153
\endrst */
154154
class scoped_ostream_redirect {

include/pybind11/pybind11.h

+18-14
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,8 @@ class module_ : public object {
11661166
already exists.
11671167
11681168
``overwrite`` should almost always be false: attempting to overwrite objects that pybind11
1169-
has established will, in most cases, break things. \endrst */
1169+
has established will, in most cases, break things.
1170+
\endrst */
11701171
PYBIND11_NOINLINE void add_object(const char *name, handle obj, bool overwrite = false) {
11711172
if (!overwrite && hasattr(*this, name))
11721173
pybind11_fail(
@@ -2657,12 +2658,13 @@ PYBIND11_NAMESPACE_END(detail)
26572658

26582659
/** \rst
26592660
Try to retrieve a python method by the provided name from the instance pointed to by the
2660-
this_ptr.
2661+
this_ptr.
26612662
26622663
:this_ptr: The pointer to the object the overridden method should be retrieved for. This should
2663-
be the first non-trampoline class encountered in the inheritance chain. :name: The name of the
2664-
overridden Python method to retrieve. :return: The Python method by this name from the object or
2665-
an empty function wrapper. \endrst */
2664+
be the first non-trampoline class encountered in the inheritance chain.
2665+
:name: The name of the overridden Python method to retrieve.
2666+
:return: The Python method by this name from the object or an empty function wrapper.
2667+
\endrst */
26662668
template <class T>
26672669
function get_override(const T *this_ptr, const char *name) {
26682670
auto *tinfo = detail::get_type_info(typeid(T));
@@ -2686,10 +2688,10 @@ function get_override(const T *this_ptr, const char *name) {
26862688

26872689
/** \rst
26882690
Macro to populate the virtual method in the trampoline class. This macro tries to look up a
2689-
method named 'fn' from the Python side, deals with the :ref:`gil` and necessary argument
2690-
conversions to call this method and return the appropriate type. See :ref:`overriding_virtuals` for
2691-
more information. This macro should be used when the method name in C is not the same as the method
2692-
name in Python. For example with `__str__`.
2691+
method named 'fn' from the Python side, deals with the :ref:`gil` and necessary argument
2692+
conversions to call this method and return the appropriate type.
2693+
See :ref:`overriding_virtuals` for more information. This macro should be used when the method
2694+
name in C is not the same as the method name in Python. For example with `__str__`.
26932695
26942696
.. code-block:: cpp
26952697
@@ -2710,7 +2712,8 @@ name in Python. For example with `__str__`.
27102712

27112713
/** \rst
27122714
Macro for pure virtual functions, this function is identical to
2713-
:c:macro:`PYBIND11_OVERRIDE_NAME`, except that it throws if no override can be found. \endrst */
2715+
:c:macro:`PYBIND11_OVERRIDE_NAME`, except that it throws if no override can be found.
2716+
\endrst */
27142717
#define PYBIND11_OVERRIDE_PURE_NAME(ret_type, cname, name, fn, ...) \
27152718
do { \
27162719
PYBIND11_OVERRIDE_IMPL(PYBIND11_TYPE(ret_type), PYBIND11_TYPE(cname), name, __VA_ARGS__); \
@@ -2720,9 +2723,9 @@ name in Python. For example with `__str__`.
27202723

27212724
/** \rst
27222725
Macro to populate the virtual method in the trampoline class. This macro tries to look up the
2723-
method from the Python side, deals with the :ref:`gil` and necessary argument conversions to call
2724-
this method and return the appropriate type. This macro should be used if the method name in C and
2725-
in Python are identical. See :ref:`overriding_virtuals` for more information.
2726+
method from the Python side, deals with the :ref:`gil` and necessary argument conversions to
2727+
call this method and return the appropriate type. This macro should be used if the method name
2728+
in C and in Python are identical. See :ref:`overriding_virtuals` for more information.
27262729
27272730
.. code-block:: cpp
27282731
@@ -2747,7 +2750,8 @@ in Python are identical. See :ref:`overriding_virtuals` for more information.
27472750

27482751
/** \rst
27492752
Macro for pure virtual functions, this function is identical to :c:macro:`PYBIND11_OVERRIDE`,
2750-
except that it throws if no override can be found. \endrst */
2753+
except that it throws if no override can be found.
2754+
\endrst */
27512755
#define PYBIND11_OVERRIDE_PURE(ret_type, cname, fn, ...) \
27522756
PYBIND11_OVERRIDE_PURE_NAME( \
27532757
PYBIND11_TYPE(ret_type), PYBIND11_TYPE(cname), #fn, fn, __VA_ARGS__)

include/pybind11/pytypes.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -1832,8 +1832,7 @@ class memoryview : public object {
18321832
18331833
See also: Python C API documentation for `PyMemoryView_FromBuffer`_.
18341834
1835-
.. _PyMemoryView_FromBuffer:
1836-
https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromBuffer
1835+
.. _PyMemoryView_FromBuffer: https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromBuffer
18371836
18381837
:param ptr: Pointer to the buffer.
18391838
:param itemsize: Byte size of an element.
@@ -1894,8 +1893,7 @@ class memoryview : public object {
18941893
18951894
See also: Python C API documentation for `PyMemoryView_FromBuffer`_.
18961895
1897-
.. _PyMemoryView_FromMemory:
1898-
https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromMemory \endrst */
1896+
.. _PyMemoryView_FromMemory: https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromMemory \endrst */
18991897
static memoryview from_memory(void *mem, ssize_t size, bool readonly = false) {
19001898
PyObject *ptr = PyMemoryView_FromMemory(
19011899
reinterpret_cast<char *>(mem), size, (readonly) ? PyBUF_READ : PyBUF_WRITE);

0 commit comments

Comments
 (0)