From 23109ef11e91c49b56b517ce454bcf87a4153c62 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 26 Oct 2004 08:59:14 +0000 Subject: SF bug #1053819: Segfault in tuple_of_constants Peepholer could be fooled into misidentifying a tuple_of_constants. Added code to count consecutive occurrences of LOAD_CONST. Use the count to weed out the misidentified cases. Added a unittest. --- Python/compile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Python') diff --git a/Python/compile.c b/Python/compile.c index dfb94d38e3..37793caaac 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -419,15 +419,16 @@ tuple_of_constants(unsigned char *codestr, int n, PyObject *consts) newconst = PyTuple_New(n); if (newconst == NULL) return 0; + len_consts = PyList_GET_SIZE(consts); for (i=0 ; i= 0 && + j == lastlc && codestr[h] == LOAD_CONST && ISBASICBLOCK(blocks, h, 3*(j+1)) && tuple_of_constants(&codestr[h], j, consts)) { -- cgit v1.2.1