Skip to content

Commit 9ed317f

Browse files
ngoldbaumseberg
andcommitted
Apply suggestions from code review
Co-authored-by: Sebastian Berg <[email protected]>
1 parent a334ddc commit 9ed317f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

numpy/_core/src/multiarray/npy_static_data.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,12 @@ initialize_static_globals(void)
156156

157157
// default_truediv_type_tupS
158158
PyArray_Descr *tmp = PyArray_DescrFromType(NPY_DOUBLE);
159-
if (tmp == NULL) {
160-
return -1;
161-
}
162-
163159
npy_static_pydata.default_truediv_type_tup =
164160
PyTuple_Pack(3, tmp, tmp, tmp);
161+
Py_DECREF(tmp);
165162
if (npy_static_pydata.default_truediv_type_tup == NULL) {
166-
Py_DECREF(tmp);
167163
return -1;
168164
}
169-
Py_DECREF(tmp);
170165

171166
npy_static_pydata.kwnames_is_copy = Py_BuildValue("(s)", "copy");
172167
if (npy_static_pydata.kwnames_is_copy == NULL) {
@@ -225,6 +220,8 @@ initialize_static_globals(void)
225220

226221
return 0;
227222
}
223+
224+
228225
/*
229226
* Verifies all entries in npy_interned_str and npy_static_pydata are
230227
* non-NULL.
@@ -234,7 +231,6 @@ initialize_static_globals(void)
234231
* items that are initialized late in module initialization but they
235232
* should all be initialized by the time this function is called.
236233
*/
237-
238234
NPY_NO_EXPORT int
239235
verify_static_structs_initialized(void) {
240236
// verify all entries in npy_interned_str are filled in

0 commit comments

Comments
 (0)