[Python-Dev] 're' crashes ?
Thomas Wouters
thomas@xs4all.net
Sat, 12 Aug 2000 21:45:24 +0200
I'm not trying to sound like Eric (though I don't mind if I do ;) but my
Python crashes. Or rather, test_re fails with a coredump, since this
afternoon or so. I'm fairly certain it was working fine yesterday, and it's
an almost-vanilla CVS tree (I was about to check-in the fixes to
Tools/compiler, and tried to use the compiler on the std lib and the test
suite, when I noticed the coredump.)
The coredump says this:
#0 eval_code2 (co=0x824ba50, globals=0x82239b4, locals=0x0, args=0x827e18c,
argcount=2, kws=0x827e194, kwcount=0, defs=0x82211c0, defcount=1,
owner=0x0) at ceval.c:1474
1474 Py_DECREF(w);
Which is part of the FOR_LOOP opcode:
1461 case FOR_LOOP:
1462 /* for v in s: ...
1463 On entry: stack contains s, i.
1464 On exit: stack contains s, i+1, s[i];
1465 but if loop exhausted:
1466 s, i are popped, and we jump */
1467 w = POP(); /* Loop index */
1468 v = POP(); /* Sequence object */
1469 u = loop_subscript(v, w);
1470 if (u != NULL) {
1471 PUSH(v);
1472 x = PyInt_FromLong(PyInt_AsLong(w)+1);
1473 PUSH(x);
1474 Py_DECREF(w);
1475 PUSH(u);
1476 if (x != NULL) continue;
1477 }
1478 else {
1479 Py_DECREF(v);
1480 Py_DECREF(w);
1481 /* A NULL can mean "s exhausted"
1482 but also an error: */
1483 if (PyErr_Occurred())
1484 why = WHY_EXCEPTION;
I *think* this isn't caused by this code, but rather by a refcounting bug
somewhere. 'w' should be an int, and it's used on line 1472, and doesn't
cause an error there (unless passing a NULL pointer to PyInt_AsLong() isn't
an error ?) But it's NULL at line 1474. Is there an easy way to track an
error like this ? Otherwise I'll play around a bit using breakpoints and
such in gdb.
--
Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!