From 42ca807c82b0b24a6ee82a20ee7cdf47d165ad83 Mon Sep 17 00:00:00 2001 From: Jim Bosch Date: Wed, 6 Oct 2010 00:31:09 +0000 Subject: [PATCH] boost.python.numpy - fixed missing bool instantiation for dtype::get_builtin --- libs/python/numpy/src/dtype.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/python/numpy/src/dtype.cpp b/libs/python/numpy/src/dtype.cpp index fc882ac9..7f9ea37e 100644 --- a/libs/python/numpy/src/dtype.cpp +++ b/libs/python/numpy/src/dtype.cpp @@ -57,6 +57,7 @@ int dtype::get_itemsize() const { template dtype dtype::get_builtin() { return dtype_traits::get(); } +NUMPY_DTYPE_TRAITS_BUILTIN(bool, NPY_BOOL); NUMPY_DTYPE_TRAITS_BUILTIN(npy_ubyte, NPY_UBYTE); NUMPY_DTYPE_TRAITS_BUILTIN(npy_byte, NPY_BYTE); NUMPY_DTYPE_TRAITS_BUILTIN(npy_ushort, NPY_USHORT); @@ -76,14 +77,16 @@ NUMPY_DTYPE_TRAITS_COMPLEX(float, npy_cfloat, NPY_CFLOAT); NUMPY_DTYPE_TRAITS_COMPLEX(double, npy_cdouble, NPY_CDOUBLE); NUMPY_DTYPE_TRAITS_COMPLEX(long double, npy_clongdouble, NPY_CLONGDOUBLE); +#if 0 template <> struct dtype_traits { static dtype get() { - if (sizeof(bool) == sizeof(npy_bool)) return dtype_traits::get(); if (sizeof(bool) == sizeof(npy_ubyte)) return dtype_traits::get(); + if (sizeof(bool) == sizeof(npy_bool)) return dtype_traits::get(); PyErr_SetString(PyExc_TypeError, "Cannot determine numpy dtype corresponding to C++ bool."); throw_error_already_set(); } }; template dtype dtype::get_builtin(); +#endif }}} // namespace boost::python::numpy