From 43a88f4574269c5d8e621b6e15f0fcfb2fe317a2 Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Sat, 22 Oct 2016 10:52:05 +0100 Subject: [PATCH] Reraise existing exception if dtype ctor fails --- include/pybind11/numpy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 1dc2d04b9..4111ccd7b 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -189,7 +189,7 @@ public: static dtype from_args(object args) { PyObject *ptr = nullptr; if (!detail::npy_api::get().PyArray_DescrConverter_(args.release().ptr(), &ptr) || !ptr) - pybind11_fail("NumPy: failed to create structured dtype"); + throw error_already_set(); return object(ptr, false); }