Skip to content

Commit 66174a1

Browse files
committed
optimize if-branches
1 parent 91558ca commit 66174a1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/itertoolsmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3287,11 +3287,11 @@ itertools_count_impl(PyTypeObject *type, PyObject *long_cnt,
32873287
if (fast_mode) {
32883288
assert(PyLong_Check(long_cnt));
32893289
cnt = PyLong_AsSsize_t(long_cnt);
3290-
if (cnt == PY_SSIZE_T_MAX) {
3290+
if (cnt == -1 && PyErr_Occurred()) {
3291+
PyErr_Clear();
32913292
fast_mode = 0;
32923293
}
3293-
else if (cnt == -1 && PyErr_Occurred()) {
3294-
PyErr_Clear();
3294+
else if (cnt == PY_SSIZE_T_MAX) {
32953295
fast_mode = 0;
32963296
}
32973297
}

0 commit comments

Comments
 (0)