Skip to content

Commit 2a7a4d3

Browse files
committed
Clean-up unused path
1 parent 6ce5cb0 commit 2a7a4d3

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

Modules/itertoolsmodule.c

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,28 +1053,18 @@ itertools_tee_impl(PyObject *module, PyObject *iterable, Py_ssize_t n)
10531053
return NULL;
10541054
}
10551055

1056-
if (PyObject_GetOptionalAttr(it, &_Py_ID(__copy__), &copyfunc) < 0) {
1057-
Py_DECREF(it);
1056+
itertools_state *state = get_module_state(module);
1057+
copyable = tee_fromiterable(state, it);
1058+
Py_DECREF(it);
1059+
if (copyable == NULL) {
10581060
Py_DECREF(result);
10591061
return NULL;
10601062
}
1061-
if (copyfunc != NULL && 0) {
1062-
copyable = it;
1063-
}
1064-
else {
1065-
itertools_state *state = get_module_state(module);
1066-
copyable = tee_fromiterable(state, it);
1067-
Py_DECREF(it);
1068-
if (copyable == NULL) {
1069-
Py_DECREF(result);
1070-
return NULL;
1071-
}
1072-
copyfunc = PyObject_GetAttr(copyable, &_Py_ID(__copy__));
1073-
if (copyfunc == NULL) {
1074-
Py_DECREF(copyable);
1075-
Py_DECREF(result);
1076-
return NULL;
1077-
}
1063+
copyfunc = PyObject_GetAttr(copyable, &_Py_ID(__copy__));
1064+
if (copyfunc == NULL) {
1065+
Py_DECREF(copyable);
1066+
Py_DECREF(result);
1067+
return NULL;
10781068
}
10791069

10801070
PyTuple_SET_ITEM(result, 0, copyable);

0 commit comments

Comments
 (0)