mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 22:52:01 +00:00
fix: issuses detected by static analyzer (#4440)
* fix incorrect variable check * remove duplicated check * remove unneeded const cast
This commit is contained in:
parent
050de893cd
commit
9d6a79c090
@ -399,7 +399,7 @@ struct process_attribute<doc> : process_attribute_default<doc> {
|
|||||||
template <>
|
template <>
|
||||||
struct process_attribute<const char *> : process_attribute_default<const char *> {
|
struct process_attribute<const char *> : process_attribute_default<const char *> {
|
||||||
static void init(const char *d, function_record *r) { r->doc = const_cast<char *>(d); }
|
static void init(const char *d, function_record *r) { r->doc = const_cast<char *>(d); }
|
||||||
static void init(const char *d, type_record *r) { r->doc = const_cast<char *>(d); }
|
static void init(const char *d, type_record *r) { r->doc = d; }
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct process_attribute<char *> : process_attribute<const char *> {};
|
struct process_attribute<char *> : process_attribute<const char *> {};
|
||||||
|
@ -176,7 +176,7 @@ struct type_caster<Type, typename eigen_tensor_helper<Type>::ValidType> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!convert && !temp.dtype().is(dtype::of<typename Type::Scalar>())) {
|
if (!temp.dtype().is(dtype::of<typename Type::Scalar>())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ struct error_fetch_and_normalize {
|
|||||||
"active exception.");
|
"active exception.");
|
||||||
}
|
}
|
||||||
const char *exc_type_name_norm = detail::obj_class_name(m_type.ptr());
|
const char *exc_type_name_norm = detail::obj_class_name(m_type.ptr());
|
||||||
if (exc_type_name_orig == nullptr) {
|
if (exc_type_name_norm == nullptr) {
|
||||||
pybind11_fail("Internal error: " + std::string(called)
|
pybind11_fail("Internal error: " + std::string(called)
|
||||||
+ " failed to obtain the name "
|
+ " failed to obtain the name "
|
||||||
"of the normalized active exception type.");
|
"of the normalized active exception type.");
|
||||||
|
Loading…
Reference in New Issue
Block a user