diff --git a/include/pybind/cast.h b/include/pybind/cast.h index b7c6558db..bf8959123 100644 --- a/include/pybind/cast.h +++ b/include/pybind/cast.h @@ -13,6 +13,7 @@ #include #include #include +#include NAMESPACE_BEGIN(pybind) NAMESPACE_BEGIN(detail) @@ -224,8 +225,10 @@ protected: bool load(PyObject *src, bool) { \ py_type py_value = from_type(src); \ if ((py_value == (py_type) -1 && PyErr_Occurred()) || \ - py_value < std::numeric_limits::min() || \ - py_value > std::numeric_limits::max()) { \ + (std::numeric_limits::is_integer && \ + sizeof(py_type) != sizeof(type) && \ + (py_value < std::numeric_limits::min() || \ + py_value > std::numeric_limits::max()))) { \ PyErr_Clear(); \ return false; \ } \ diff --git a/include/pybind/functional.h b/include/pybind/functional.h index 8f7aae821..7c3c9a006 100644 --- a/include/pybind/functional.h +++ b/include/pybind/functional.h @@ -24,7 +24,7 @@ public: return false; object src(src_, true); value = [src](Args... args) -> Return { - object retval(pybind::handle(src).call(std::move(args)...)); + object retval(pybind::handle(src).call(std::move(args)...)); /* Visual studio 2015 parser issue: need parentheses around this expression */ return (retval.template cast()); };