diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 4cfbf138a2811f..35900073ea63c2 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -5032,7 +5032,7 @@ dummy_func( PyTypeObject *type = Py_TYPE(iterable); if (oparg == 0) { // Sync case, similar to GET_ITER - if (type->tp_iter == NULL || !PySequence_Check(iterable)) { + if (type->tp_iter == NULL && !PySequence_Check(iterable)) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not iterable", type->tp_name); diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 578a496c00581d..f8f8af2df72100 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -6002,7 +6002,7 @@ PyTypeObject *type = Py_TYPE(iterable); if (oparg == 0) { // Sync case, similar to GET_ITER - if (type->tp_iter == NULL || !PySequence_Check(iterable)) { + if (type->tp_iter == NULL && !PySequence_Check(iterable)) { _PyFrame_SetStackPointer(frame, stack_pointer); PyErr_Format(PyExc_TypeError, "'%.200s' object is not iterable", diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index f8967bbc8e334b..392b5da5082945 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -3170,7 +3170,7 @@ PyTypeObject *type = Py_TYPE(iterable); if (oparg == 0) { // Sync case, similar to GET_ITER - if (type->tp_iter == NULL || !PySequence_Check(iterable)) { + if (type->tp_iter == NULL && !PySequence_Check(iterable)) { _PyFrame_SetStackPointer(frame, stack_pointer); PyErr_Format(PyExc_TypeError, "'%.200s' object is not iterable",