mirror of https://github.com/pybind/pybind11.git
fix: avoid `catch (...)` for expected `import numpy` failures (#3974)
* Replace import numpy catch (...) with catch (error_already_set) * Add missing const (not sure how those got lost).
This commit is contained in:
parent
2c549eb7aa
commit
8d14e666e3
|
@ -162,7 +162,7 @@ static int data_i = 42;
|
|||
TEST_SUBMODULE(numpy_array, sm) {
|
||||
try {
|
||||
py::module_::import("numpy");
|
||||
} catch (...) {
|
||||
} catch (const py::error_already_set &) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ struct B {};
|
|||
TEST_SUBMODULE(numpy_dtypes, m) {
|
||||
try {
|
||||
py::module_::import("numpy");
|
||||
} catch (...) {
|
||||
} catch (const py::error_already_set &) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ double my_func(int x, float y, double z) {
|
|||
TEST_SUBMODULE(numpy_vectorize, m) {
|
||||
try {
|
||||
py::module_::import("numpy");
|
||||
} catch (...) {
|
||||
} catch (const py::error_already_set &) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue