various minor compilation fixes

This commit is contained in:
Wenzel Jakob 2015-08-28 17:53:31 +02:00
parent 5d4d83da11
commit a9ee25a97e
2 changed files with 6 additions and 3 deletions

View File

@ -13,6 +13,7 @@
#include <pybind/pytypes.h> #include <pybind/pytypes.h>
#include <pybind/typeid.h> #include <pybind/typeid.h>
#include <array> #include <array>
#include <limits>
NAMESPACE_BEGIN(pybind) NAMESPACE_BEGIN(pybind)
NAMESPACE_BEGIN(detail) NAMESPACE_BEGIN(detail)
@ -224,8 +225,10 @@ protected:
bool load(PyObject *src, bool) { \ bool load(PyObject *src, bool) { \
py_type py_value = from_type(src); \ py_type py_value = from_type(src); \
if ((py_value == (py_type) -1 && PyErr_Occurred()) || \ if ((py_value == (py_type) -1 && PyErr_Occurred()) || \
py_value < std::numeric_limits<type>::min() || \ (std::numeric_limits<type>::is_integer && \
py_value > std::numeric_limits<type>::max()) { \ sizeof(py_type) != sizeof(type) && \
(py_value < std::numeric_limits<type>::min() || \
py_value > std::numeric_limits<type>::max()))) { \
PyErr_Clear(); \ PyErr_Clear(); \
return false; \ return false; \
} \ } \

View File

@ -24,7 +24,7 @@ public:
return false; return false;
object src(src_, true); object src(src_, true);
value = [src](Args... args) -> Return { value = [src](Args... args) -> Return {
object retval(pybind::handle(src).call<Args...>(std::move(args)...)); object retval(pybind::handle(src).call(std::move(args)...));
/* Visual studio 2015 parser issue: need parentheses around this expression */ /* Visual studio 2015 parser issue: need parentheses around this expression */
return (retval.template cast<Return>()); return (retval.template cast<Return>());
}; };