Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 9 additions & 5 deletions include/pybind11/detail/type_caster_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ PYBIND11_NOINLINE detail::type_info *get_type_info(const std::type_index &tp,
if (throw_if_missing) {
std::string tname = tp.name();
detail::clean_type_id(tname);
pybind11_fail("pybind11::detail::get_type_info: unable to find type info for \"" + tname
+ "\"");
pybind11_fail("pybind11::detail::get_type_info: unable to find type info for \""
+ std::move(tname) + '"');
}
return nullptr;
}
Expand Down Expand Up @@ -512,9 +512,13 @@ PYBIND11_NOINLINE std::string error_string() {
Py_INCREF(f_code);
# endif
int lineno = PyFrame_GetLineNumber(frame);
errorString += " " + handle(f_code->co_filename).cast<std::string>() + "("
+ std::to_string(lineno)
+ "): " + handle(f_code->co_name).cast<std::string>() + "\n";
errorString += " ";
errorString += handle(f_code->co_filename).cast<std::string>();
errorString += '(';
errorString += std::to_string(lineno);
errorString += "): ";
errorString += handle(f_code->co_name).cast<std::string>();
errorString += '\n';
Py_DECREF(f_code);
# if PY_VERSION_HEX >= 0x030900B1
auto *b_frame = PyFrame_GetBack(frame);
Expand Down
5 changes: 3 additions & 2 deletions include/pybind11/eigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ struct type_caster<Type, enable_if_t<is_eigen_sparse<Type>::value>> {
Type::Flags &(Eigen::RowMajor | Eigen::ColMajor),
StorageIndex>(shape[0].cast<Index>(),
shape[1].cast<Index>(),
nnz,
std::move(nnz),
outerIndices.mutable_data(),
innerIndices.mutable_data(),
values.mutable_data());
Expand All @@ -686,7 +686,8 @@ struct type_caster<Type, enable_if_t<is_eigen_sparse<Type>::value>> {
array outerIndices((rowMajor ? src.rows() : src.cols()) + 1, src.outerIndexPtr());
array innerIndices(src.nonZeros(), src.innerIndexPtr());

return matrix_type(std::make_tuple(data, innerIndices, outerIndices),
return matrix_type(std::make_tuple(
std::move(data), std::move(innerIndices), std::move(outerIndices)),
std::make_pair(src.rows(), src.cols()))
.release();
}
Expand Down
6 changes: 3 additions & 3 deletions include/pybind11/numpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ class array : public buffer {

void fail_dim_check(ssize_t dim, const std::string &msg) const {
throw index_error(msg + ": " + std::to_string(dim) + " (ndim = " + std::to_string(ndim())
+ ")");
+ ')');
}

template <typename... Ix>
Expand Down Expand Up @@ -1144,11 +1144,11 @@ struct format_descriptor<T, detail::enable_if_t<detail::is_pod_struct<T>::value>

template <size_t N>
struct format_descriptor<char[N]> {
static std::string format() { return std::to_string(N) + "s"; }
static std::string format() { return std::to_string(N) + 's'; }
};
template <size_t N>
struct format_descriptor<std::array<char, N>> {
static std::string format() { return std::to_string(N) + "s"; }
static std::string format() { return std::to_string(N) + 's'; }
};

template <typename T>
Expand Down
12 changes: 6 additions & 6 deletions include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -561,14 +561,14 @@ class cpp_function : public function {
for (auto *it = chain_start; it != nullptr; it = it->next) {
if (options::show_function_signatures()) {
if (index > 0) {
signatures += "\n";
signatures += '\n';
}
if (chain) {
signatures += std::to_string(++index) + ". ";
}
signatures += rec->name;
signatures += it->signature;
signatures += "\n";
signatures += '\n';
}
if (it->doc && it->doc[0] != '\0' && options::show_user_defined_docstrings()) {
// If we're appending another docstring, and aren't printing function signatures,
Expand All @@ -577,15 +577,15 @@ class cpp_function : public function {
if (first_user_def) {
first_user_def = false;
} else {
signatures += "\n";
signatures += '\n';
}
}
if (options::show_function_signatures()) {
signatures += "\n";
signatures += '\n';
}
signatures += it->doc;
if (options::show_function_signatures()) {
signatures += "\n";
signatures += '\n';
}
}
}
Expand Down Expand Up @@ -1055,7 +1055,7 @@ class cpp_function : public function {
msg += it2->signature;
}

msg += "\n";
msg += '\n';
}
msg += "\nInvoked with: ";
auto args_ = reinterpret_borrow<tuple>(args_in);
Expand Down