Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FormatStyle: file

Checks: '
*bugprone*,
cppcoreguidelines-init-variables,
clang-analyzer-optin.cplusplus.VirtualCall,
llvm-namespace-comment,
Expand Down Expand Up @@ -43,6 +44,10 @@ readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release,
-bugprone-exception-escape,
-bugprone-macro-parentheses,
-bugprone-reserved-identifier,
-bugprone-unused-raii,
'

CheckOptions:
Expand Down
5 changes: 2 additions & 3 deletions include/pybind11/cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,8 @@ struct type_caster<T, enable_if_t<std::is_arithmetic<T>::value && !is_std_char_t
py_value = (py_type) PyFloat_AsDouble(src.ptr());
else
return false;
} else if (PyFloat_Check(src.ptr())) {
return false;
} else if (!convert && !PYBIND11_LONG_CHECK(src.ptr()) && !index_check(src.ptr())) {
} else if (PyFloat_Check(src.ptr())
|| (!convert && !PYBIND11_LONG_CHECK(src.ptr()) && !index_check(src.ptr()))) {
return false;
} else {
handle src_or_index = src;
Expand Down
1 change: 1 addition & 0 deletions include/pybind11/detail/type_caster_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class loader_life_support {
}

/// ... and destroyed after it returns
// NOLINTNEXTLINE(bugprone-exception-escape) See issue #2215
~loader_life_support() {
auto &stack = get_internals().loader_patient_stack;
if (stack.empty())
Expand Down
2 changes: 2 additions & 0 deletions include/pybind11/gil.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class gil_scoped_release {
active = false;
}

// NOLINTNEXTLINE(bugprone-exception-escape) See issue #2215
~gil_scoped_release() {
if (!tstate)
return;
Expand All @@ -160,6 +161,7 @@ class gil_scoped_release {
PYBIND11_TLS_REPLACE_VALUE(key, tstate);
}
}

private:
PyThreadState *tstate;
bool disassoc;
Expand Down
1 change: 1 addition & 0 deletions include/pybind11/numpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,7 @@ struct vectorize_helper {
"pybind11::vectorize(...) requires a function with at least one vectorizable argument");

public:
// NOLINTNEXTLINE(bugprone-forwarding-reference-overload) //TODO FIX BEFORE MERGE
template <typename T>
explicit vectorize_helper(T &&f) : f(std::forward<T>(f)) { }

Expand Down
6 changes: 5 additions & 1 deletion tests/test_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ TEST_SUBMODULE(buffers, m) {
}

Matrix &operator=(const Matrix &s) {
print_copy_assigned(this, std::to_string(m_rows) + "x" + std::to_string(m_cols) + " matrix");
if (this == &s) {
return *this;
}
print_copy_assigned(this,
std::to_string(m_rows) + "x" + std::to_string(m_cols) + " matrix");
delete[] m_data;
m_rows = s.m_rows;
m_cols = s.m_cols;
Expand Down