8000 MAINT: respond to code review · numpy/numpy@96ca7e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96ca7e3

Browse files
ngoldbaumcharris
authored andcommitted
MAINT: respond to code review
1 parent c20ac88 commit 96ca7e3

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

numpy/_core/src/multiarray/convert_datatype.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,15 @@ ensure_castingimpl_exists(PyArray_DTypeMeta *from, PyArray_DTypeMeta *to)
150150
&res) < 0) {
151151
return_error = 1;
152152
}
153-
154-
if (res == NULL && !return_error) {
153+
else if (res == NULL) {
155154
res = create_casting_impl(from, to);
156155
if (res == NULL) {
157156
return_error = 1;
158157
}
159-
}
160-
if (!return_error &&
161-
PyDict_SetItem(NPY_DT_SLOTS(from)->castingimpls,
162-
(PyObject *)to, res) < 0) {
163-
return_error = 1;
158+
else if (PyDict_SetItem(NPY_DT_SLOTS(from)->castingimpls,
159+
(PyObject *)to, res) < 0) {
160+
return_error = 1;
161+
}
164162
}
165163
Py_END_CRITICAL_SECTION();
166164
if (return_error) {

numpy/testing/_private/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,13 +2704,11 @@ def run_threaded(func, max_workers=8, pass_count=False,
27042704
else:
27052705
all_args = [(func, *args) for i in range(max_workers)]
27062706
try:
2707-
n_submitted = 0
27082707
futures = []
27092708
for arg in all_args:
27102709
futures.append(tpe.submit(*arg))
2711-
n_submitted += 1
27122710
finally:
2713-
if n_submitted < max_workers and pass_barrier:
2711+
if len(futures) < max_workers and pass_barrier:
27142712
barrier.abort()
27152713
for f in futures:
27162714
f.result()

0 commit comments

Comments
 (0)
0