Skip to content

Commit c079bef

Browse files
committed
fixup! Can disable the section headings in docstrings
1 parent 27b6e44 commit c079bef

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

.github/CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The valid options are:
9393
* `-DPYBIND11_NOPYTHON=ON`: Disable all Python searching (disables tests)
9494
* `-DBUILD_TESTING=ON`: Enable the tests
9595
* `-DDOWNLOAD_CATCH=ON`: Download catch to build the C++ tests
96-
* `-DOWNLOAD_EIGEN=ON`: Download Eigen for the NumPy tests
96+
* `-DDOWNLOAD_EIGEN=ON`: Download Eigen for the NumPy tests
9797
* `-DPYBIND11_INSTALL=ON/OFF`: Enable the install target (on by default for the
9898
master project)
9999
* `-DUSE_PYTHON_INSTALL_DIR=ON`: Try to install into the python dir

docs/advanced/misc.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ For example:
317317
>>> help(example.add)
318318
319319
add(...)
320-
| add(arg0: int, arg1: int) -> int
320+
| add(arg0: int, arg1: int) -> int\
321321
| add(arg0: float, arg1: float) -> float
322322
| Overloaded function.
323323
|
@@ -355,8 +355,8 @@ The above example would produce the following docstring:
355355
>>> help(example.add)
356356
357357
add(...)
358-
| add(arg0: int, arg1: int) -> int
359-
| add(arg0: float, arg1: float) -> float
358+
| add(arg0: int, arg1: int) -> int\
359+
| add(arg0: float, arg1: float) -> float\
360360
| add(arg0: None, arg1: None) -> None
361361
| A function which adds two numbers.
362362
|

include/pybind11/pybind11.h

+1
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ class cpp_function : public function {
411411
for (auto it = chain_start; it != nullptr; it = it->next) {
412412
signatures += rec->name;
413413
signatures += it->signature;
414+
if (it->next != nullptr) signatures += "\\";
414415
signatures += "\n";
415416
}
416417
if (options::show_section_headings()) {

tests/test_factory_constructors.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ def test_init_factory_signature(msg):
8888
assert (
8989
msg(m.TestFactory1.__init__.__doc__)
9090
== """
91-
__init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: int) -> None
92-
__init__(self: m.factory_constructors.TestFactory1, arg0: str) -> None
93-
__init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.pointer_tag) -> None
91+
__init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: int) -> None\\
92+
__init__(self: m.factory_constructors.TestFactory1, arg0: str) -> None\\
93+
__init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.pointer_tag) -> None\\
9494
__init__(self: m.factory_constructors.TestFactory1, arg0: handle, arg1: int, arg2: handle) -> None
9595
Overloaded function.
9696
@@ -107,8 +107,8 @@ def test_init_factory_signature(msg):
107107
assert (
108108
msg(m.TestFactory2.__init__.__doc__)
109109
== """
110-
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.pointer_tag, arg1: int) -> None
111-
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: str) -> None
110+
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.pointer_tag, arg1: int) -> None\\
111+
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: str) -> None\\
112112
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.move_tag) -> None
113113
This is one part of the docstring.
114114
This is the other part of the docstring.

0 commit comments

Comments
 (0)