Skip to content

Commit b34b2ac

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

File tree

4 files changed

+30
-20
lines changed

4 files changed

+30
-20
lines changed

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
@@ -1168,8 +1168,8 @@ class module_ : public object {
11681168
Adds an object to the module using the given name. Throws if an object with the given name
11691169
already exists.
11701170
1171-
``overwrite`` should almost always be false: attempting to overwrite objects that pybind11 has
1172-
established will, in most cases, break things.
1171+
``overwrite`` should almost always be false: attempting to overwrite objects that pybind11
1172+
has established will, in most cases, break things.
11731173
\endrst */
11741174
PYBIND11_NOINLINE void add_object(const char *name, handle obj, bool overwrite = false) {
11751175
if (!overwrite && hasattr(*this, name)) {
@@ -2560,10 +2560,11 @@ inline function get_type_override(const void *this_ptr, const type_info *this_ty
25602560
PYBIND11_NAMESPACE_END(detail)
25612561

25622562
/** \rst
2563-
Try to retrieve a python method by the provided name from the instance pointed to by the this_ptr.
2563+
Try to retrieve a python method by the provided name from the instance pointed to by the
2564+
this_ptr.
25642565
2565-
:this_ptr: The pointer to the object the overridden method should be retrieved for. This should be
2566-
the first non-trampoline class encountered in the inheritance chain.
2566+
:this_ptr: The pointer to the object the overridden method should be retrieved for. This should
2567+
be the first non-trampoline class encountered in the inheritance chain.
25672568
:name: The name of the overridden Python method to retrieve.
25682569
:return: The Python method by this name from the object or an empty function wrapper.
25692570
\endrst */
@@ -2588,9 +2589,10 @@ template <class T> function get_override(const T *this_ptr, const char *name) {
25882589
} while (false)
25892590

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

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

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

26502653
/** \rst
2651-
Macro for pure virtual functions, this function is identical to :c:macro:`PYBIND11_OVERRIDE`, except that it throws
2652-
if no override can be found.
2654+
Macro for pure virtual functions, this function is identical to :c:macro:`PYBIND11_OVERRIDE`,
2655+
except that it throws if no override can be found.
26532656
\endrst */
26542657
#define PYBIND11_OVERRIDE_PURE(ret_type, cname, fn, ...) \
26552658
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)