def test_folding_of_tuples_of_constants(self):
for line, elem in (
- ('a = 1,2,3', '((1, 2, 3))',),
- ('("a","b","c")', "(('a', 'b', 'c'))",),
- ('a,b,c = 1,2,3', '((1, 2, 3))',),
+ ('a = 1,2,3', '((1, 2, 3))'),
+ ('("a","b","c")', "(('a', 'b', 'c'))"),
+ ('a,b,c = 1,2,3', '((1, 2, 3))'),
+ ('(None, 1, None)', '((None, 1, None))'),
+ ('((1, 2), 3, 4)', '(((1, 2), 3, 4))'),
):
asm = dis_single(line)
self.assert_(elem in asm)
if (PyList_GET_ITEM(consts, j) == Py_None) {
codestr[i] = LOAD_CONST;
SETARG(codestr, i, j);
+ cumlc = lastlc + 1;
break;
}
}
!PyObject_IsTrue(PyList_GET_ITEM(consts, j)))
continue;
memset(codestr+i, NOP, 7);
+ cumlc = 0;
break;
/* Try to fold tuples of constants.
codestr[h] == LOAD_CONST &&
ISBASICBLOCK(blocks, h, 3*(j+1)) &&
tuple_of_constants(&codestr[h], j, consts)) {
+ assert(codestr[i] == LOAD_CONST);
+ cumlc = 1;
break;
}
/* Intentional fallthrough */