@@ -120,22 +120,19 @@ inline numpy_internals &get_numpy_internals() {
120
120
return *ptr;
121
121
}
122
122
123
- module_ import_numpy_core_submodule (const char * submodule_name) {
123
+ module_ import_numpy_core_submodule (const char *submodule_name) {
124
124
try {
125
- return module_::import (
126
- (std::string (" numpy._core." ) + submodule_name).c_str ()
127
- );
125
+ return module_::import ((std::string (" numpy._core." ) + submodule_name).c_str ());
128
126
} catch (error_already_set &ex) {
129
- if (!ex.matches (PyExc_ImportError)) throw ;
127
+ if (!ex.matches (PyExc_ImportError))
128
+ throw ;
130
129
try {
131
- return module_::import (
132
- (std::string (" numpy.core." ) + submodule_name).c_str ()
133
- );
134
- } catch (error_already_set &ex) {
135
- if (!ex.matches (PyExc_ImportError)) throw ;
136
- throw import_error (
137
- std::string (" pybind11 couldn't import " ) + submodule_name + " from numpy."
138
- );
130
+ return module_::import ((std::string (" numpy.core." ) + submodule_name).c_str ());
131
+ } catch (error_already_set &ex) {
132
+ if (!ex.matches (PyExc_ImportError))
133
+ throw ;
134
+ throw import_error (std::string (" pybind11 couldn't import " ) + submodule_name
135
+ + " from numpy." );
139
136
}
140
137
}
141
138
}
@@ -647,10 +644,7 @@ class dtype : public object {
647
644
private:
648
645
static object _dtype_from_pep3118 () {
649
646
module_ m = import_numpy_core_submodule (" _internal" );
650
- static PyObject *obj = m.attr (" _dtype_from_pep3118" )
651
- .cast <object>()
652
- .release ()
653
- .ptr ();
647
+ static PyObject *obj = m.attr (" _dtype_from_pep3118" ).cast <object>().release ().ptr ();
654
648
return reinterpret_borrow<object>(obj);
655
649
}
656
650
0 commit comments