mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 14:45:12 +00:00
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) {
|
TEST_SUBMODULE(numpy_array, sm) {
|
||||||
try {
|
try {
|
||||||
py::module_::import("numpy");
|
py::module_::import("numpy");
|
||||||
} catch (...) {
|
} catch (const py::error_already_set &) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ struct B {};
|
|||||||
TEST_SUBMODULE(numpy_dtypes, m) {
|
TEST_SUBMODULE(numpy_dtypes, m) {
|
||||||
try {
|
try {
|
||||||
py::module_::import("numpy");
|
py::module_::import("numpy");
|
||||||
} catch (...) {
|
} catch (const py::error_already_set &) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ double my_func(int x, float y, double z) {
|
|||||||
TEST_SUBMODULE(numpy_vectorize, m) {
|
TEST_SUBMODULE(numpy_vectorize, m) {
|
||||||
try {
|
try {
|
||||||
py::module_::import("numpy");
|
py::module_::import("numpy");
|
||||||
} catch (...) {
|
} catch (const py::error_already_set &) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user