renamed _check -> check_

(Identifiers starting with underscores are reserved by the standard)
Also fixed a typo in a comment.
This commit is contained in:
Wenzel Jakob 2017-02-07 00:06:04 +01:00
parent 6fa316d259
commit 0defac5977
2 changed files with 4 additions and 4 deletions

View File

@ -349,7 +349,7 @@ public:
int flags = 0; int flags = 0;
if (base && ptr) { if (base && ptr) {
if (isinstance<array>(base)) if (isinstance<array>(base))
/* Copy flags from base (except baseship bit) */ /* Copy flags from base (except ownership bit) */
flags = reinterpret_borrow<array>(base).flags() & ~detail::npy_api::NPY_ARRAY_OWNDATA_; flags = reinterpret_borrow<array>(base).flags() & ~detail::npy_api::NPY_ARRAY_OWNDATA_;
else else
/* Writable by default, easy to downgrade later on if needed */ /* Writable by default, easy to downgrade later on if needed */
@ -639,7 +639,7 @@ public:
return result; return result;
} }
static bool _check(handle h) { static bool check_(handle h) {
const auto &api = detail::npy_api::get(); const auto &api = detail::npy_api::get();
return api.PyArray_Check_(h.ptr()) return api.PyArray_Check_(h.ptr())
&& api.PyArray_EquivTypes_(detail::array_proxy(h.ptr())->descr, dtype::of<T>().ptr()); && api.PyArray_EquivTypes_(detail::array_proxy(h.ptr())->descr, dtype::of<T>().ptr());

View File

@ -282,7 +282,7 @@ template <typename T> T reinterpret_steal(handle h) { return {h, object::stolen}
`object` or a class which was exposed to Python as ``py::class_<T>``. `object` or a class which was exposed to Python as ``py::class_<T>``.
\endrst */ \endrst */
template <typename T, detail::enable_if_t<std::is_base_of<object, T>::value, int> = 0> template <typename T, detail::enable_if_t<std::is_base_of<object, T>::value, int> = 0>
bool isinstance(handle obj) { return T::_check(obj); } bool isinstance(handle obj) { return T::check_(obj); }
template <typename T, detail::enable_if_t<!std::is_base_of<object, T>::value, int> = 0> template <typename T, detail::enable_if_t<!std::is_base_of<object, T>::value, int> = 0>
bool isinstance(handle obj) { return detail::isinstance_generic(obj, typeid(T)); } bool isinstance(handle obj) { return detail::isinstance_generic(obj, typeid(T)); }
@ -572,7 +572,7 @@ NAMESPACE_END(detail)
Name(handle h, stolen_t) : Parent(h, stolen) { } \ Name(handle h, stolen_t) : Parent(h, stolen) { } \
PYBIND11_DEPRECATED("Use py::isinstance<py::python_type>(obj) instead") \ PYBIND11_DEPRECATED("Use py::isinstance<py::python_type>(obj) instead") \
bool check() const { return m_ptr != nullptr && (bool) CheckFun(m_ptr); } \ bool check() const { return m_ptr != nullptr && (bool) CheckFun(m_ptr); } \
static bool _check(handle h) { return h.ptr() != nullptr && CheckFun(h.ptr()); } static bool check_(handle h) { return h.ptr() != nullptr && CheckFun(h.ptr()); }
#define PYBIND11_OBJECT_CVT(Name, Parent, CheckFun, ConvertFun) \ #define PYBIND11_OBJECT_CVT(Name, Parent, CheckFun, ConvertFun) \
PYBIND11_OBJECT_COMMON(Name, Parent, CheckFun) \ PYBIND11_OBJECT_COMMON(Name, Parent, CheckFun) \