Skip to content

Commit d8ec2ee

Browse files
committed
Manual line breaks to pre-empt undesired clang-formating.
Informed by work under pybind#3683: pybind@60b7eb4 pybind@59572e6
1 parent d6c66d2 commit d8ec2ee

4 files changed

Lines changed: 30 additions & 20 deletions

File tree

include/pybind11/detail/common.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,9 @@ PYBIND11_NAMESPACE_END(detail)
842842

843843
#if defined(_MSC_VER)
844844
# pragma warning(push)
845-
# pragma warning(disable: 4275) // warning C4275: An exported class was derived from a class that wasn't exported. Can be ignored when derived from a STL class.
845+
# pragma warning(disable: 4275)
846+
// warning C4275: An exported class was derived from a class that wasn't exported.
847+
// Can be ignored when derived from a STL class.
846848
#endif
847849
/// C++ bindings of builtin Python exceptions
848850
class PYBIND11_EXPORT_EXCEPTION builtin_exception : public std::runtime_error {

include/pybind11/iostream.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ PYBIND11_NAMESPACE_END(detail)
164164
.. code-block:: cpp
165165
166166
{
167-
py::scoped_ostream_redirect output{std::cerr, py::module::import("sys").attr("stderr")};
167+
py::scoped_ostream_redirect output{
168+
std::cerr, py::module::import("sys").attr("stderr")};
168169
std::cout << "Hello, World!";
169170
}
170171
\endrst */

include/pybind11/pybind11.h

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,8 +1169,8 @@ class module_ : public object {
11691169
Adds an object to the module using the given name. Throws if an object with the given name
11701170
already exists.
11711171
1172-
``overwrite`` should almost always be false: attempting to overwrite objects that pybind11 has
1173-
established will, in most cases, break things.
1172+
``overwrite`` should almost always be false: attempting to overwrite objects that pybind11
1173+
has established will, in most cases, break things.
11741174
\endrst */
11751175
PYBIND11_NOINLINE void add_object(const char *name, handle obj, bool overwrite = false) {
11761176
if (!overwrite && hasattr(*this, name)) {
@@ -2562,10 +2562,11 @@ inline function get_type_override(const void *this_ptr, const type_info *this_ty
25622562
PYBIND11_NAMESPACE_END(detail)
25632563

25642564
/** \rst
2565-
Try to retrieve a python method by the provided name from the instance pointed to by the this_ptr.
2565+
Try to retrieve a python method by the provided name from the instance pointed to by the
2566+
this_ptr.
25662567
2567-
:this_ptr: The pointer to the object the overridden method should be retrieved for. This should be
2568-
the first non-trampoline class encountered in the inheritance chain.
2568+
:this_ptr: The pointer to the object the overridden method should be retrieved for. This should
2569+
be the first non-trampoline class encountered in the inheritance chain.
25692570
:name: The name of the overridden Python method to retrieve.
25702571
:return: The Python method by this name from the object or an empty function wrapper.
25712572
\endrst */
@@ -2590,9 +2591,10 @@ template <class T> function get_override(const T *this_ptr, const char *name) {
25902591
} while (false)
25912592

25922593
/** \rst
2593-
Macro to populate the virtual method in the trampoline class. This macro tries to look up a method named 'fn'
2594-
from the Python side, deals with the :ref:`gil` and necessary argument conversions to call this method and return
2595-
the appropriate type. See :ref:`overriding_virtuals` for more information. This macro should be used when the method
2594+
Macro to populate the virtual method in the trampoline class. This macro tries to look up a
2595+
method named 'fn' from the Python side, deals with the :ref:`gil` and necessary argument
2596+
conversions to call this method and return the appropriate type.
2597+
See :ref:`overriding_virtuals` for more information. This macro should be used when the method
25962598
name in C is not the same as the method name in Python. For example with `__str__`.
25972599
25982600
.. code-block:: cpp
@@ -2613,8 +2615,8 @@ template <class T> function get_override(const T *this_ptr, const char *name) {
26132615
} while (false)
26142616

26152617
/** \rst
2616-
Macro for pure virtual functions, this function is identical to :c:macro:`PYBIND11_OVERRIDE_NAME`, except that it
2617-
throws if no override can be found.
2618+
Macro for pure virtual functions, this function is identical to
2619+
:c:macro:`PYBIND11_OVERRIDE_NAME`, except that it throws if no override can be found.
26182620
\endrst */
26192621
#define PYBIND11_OVERRIDE_PURE_NAME(ret_type, cname, name, fn, ...) \
26202622
do { \
@@ -2623,9 +2625,10 @@ template <class T> function get_override(const T *this_ptr, const char *name) {
26232625
} while (false)
26242626

26252627
/** \rst
2626-
Macro to populate the virtual method in the trampoline class. This macro tries to look up the method
2627-
from the Python side, deals with the :ref:`gil` and necessary argument conversions to call this method and return
2628-
the appropriate type. This macro should be used if the method name in C and in Python are identical.
2628+
Macro to populate the virtual method in the trampoline class. This macro tries to look up the
2629+
method from the Python side, deals with the :ref:`gil` and necessary argument conversions to
2630+
call this method and return the appropriate type. This macro should be used if the method name
2631+
in C and in Python are identical.
26292632
See :ref:`overriding_virtuals` for more information.
26302633
26312634
.. code-block:: cpp
@@ -2650,8 +2653,8 @@ template <class T> function get_override(const T *this_ptr, const char *name) {
26502653
PYBIND11_OVERRIDE_NAME(PYBIND11_TYPE(ret_type), PYBIND11_TYPE(cname), #fn, fn, __VA_ARGS__)
26512654

26522655
/** \rst
2653-
Macro for pure virtual functions, this function is identical to :c:macro:`PYBIND11_OVERRIDE`, except that it throws
2654-
if no override can be found.
2656+
Macro for pure virtual functions, this function is identical to :c:macro:`PYBIND11_OVERRIDE`,
2657+
except that it throws if no override can be found.
26552658
\endrst */
26562659
#define PYBIND11_OVERRIDE_PURE(ret_type, cname, fn, ...) \
26572660
PYBIND11_OVERRIDE_PURE_NAME(PYBIND11_TYPE(ret_type), PYBIND11_TYPE(cname), #fn, fn, __VA_ARGS__)

include/pybind11/pytypes.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ PYBIND11_NAMESPACE_END(detail)
337337

338338
#if defined(_MSC_VER)
339339
# pragma warning(push)
340-
# pragma warning(disable: 4275 4251) // warning C4275: An exported class was derived from a class that wasn't exported. Can be ignored when derived from a STL class.
340+
# pragma warning(disable: 4275 4251)
341+
// warning C4275: An exported class was derived from a class that wasn't exported.
342+
// Can be ignored when derived from a STL class.
341343
#endif
342344
/// Fetch and hold an error which was already set in Python. An instance of this is typically
343345
/// thrown to propagate python-side errors back through C++ which can either be caught manually or
@@ -1745,7 +1747,8 @@ class memoryview : public object {
17451747
17461748
See also: Python C API documentation for `PyMemoryView_FromBuffer`_.
17471749
1748-
.. _PyMemoryView_FromBuffer: https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromBuffer
1750+
.. _PyMemoryView_FromBuffer:
1751+
https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromBuffer
17491752
17501753
:param ptr: Pointer to the buffer.
17511754
:param itemsize: Byte size of an element.
@@ -1800,7 +1803,8 @@ class memoryview : public object {
18001803
18011804
See also: Python C API documentation for `PyMemoryView_FromBuffer`_.
18021805
1803-
.. _PyMemoryView_FromMemory: https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromMemory
1806+
.. _PyMemoryView_FromMemory:
1807+
https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromMemory
18041808
\endrst */
18051809
static memoryview from_memory(void *mem, ssize_t size, bool readonly = false) {
18061810
PyObject* ptr = PyMemoryView_FromMemory(

0 commit comments

Comments
 (0)