Commit a3b3b660 authored by Stefan Behnel's avatar Stefan Behnel

simplify list/tuple specialisation code in for-in loop to avoid redundant type check

parent 7a787d16
......@@ -2461,10 +2461,12 @@ class IteratorNode(ExprNode):
return
if self.may_be_a_sequence:
for test_name in ('List', 'Tuple'):
code.putln("if (!%s && Py%s_CheckExact(%s)) {" % (
self.iter_func_ptr, test_name, self.py_result()))
self.generate_next_sequence_item(test_name, result_name, code)
code.putln("if (!%s) {" % self.iter_func_ptr)
code.putln("if (PyList_CheckExact(%s)) {" % self.py_result())
self.generate_next_sequence_item('List', result_name, code)
code.putln("} else {")
self.generate_next_sequence_item('Tuple', result_name, code)
code.putln("}")
code.put("} else ")
code.putln("{")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment