Skip to content

Commit 13fb695

Browse files
style: pre-commit fixes
1 parent ee40dab commit 13fb695

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

include/pybind11/numpy.h

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,19 @@ inline numpy_internals &get_numpy_internals() {
120120
return *ptr;
121121
}
122122

123-
module_ import_numpy_core_submodule(const char * submodule_name) {
123+
module_ import_numpy_core_submodule(const char *submodule_name) {
124124
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());
128126
} catch (error_already_set &ex) {
129-
if (!ex.matches(PyExc_ImportError)) throw;
127+
if (!ex.matches(PyExc_ImportError))
128+
throw;
130129
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.");
139136
}
140137
}
141138
}
@@ -647,10 +644,7 @@ class dtype : public object {
647644
private:
648645
static object _dtype_from_pep3118() {
649646
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();
654648
return reinterpret_borrow<object>(obj);
655649
}
656650

0 commit comments

Comments
 (0)