[issue15108] ERROR: SystemError: ./../Objects/tupleobject.c:118: bad argument to internal function
Pankaj D
report at bugs.python.org
Tue Jun 19 23:52:14 CEST 2012
New submission from Pankaj D <pxd at comcast.net>:
Hi,
Sporadically, while running an sqlite3 query, the above error is seen.
In order to debug, I modified Objects/tupleobject.c, PyTuple_SetItem() as follows:
if (!PyTuple_Check(op) || op->ob_refcnt != 1) {
Py_XDECREF(newitem);
/*
* Temp: Bug XYZ Generate core so that we can debug
*
* PyErr_BadInternalCall();
* return -1;
*/
char errmsg[200];
sprintf(errmsg, "Bug XYZ: PyTuple_Check(op) = %d "
"op->ob_refcnt = %d; see core\n", PyTuple_Check(op),
op->ob_refcnt);
Py_FatalError(errmsg);
}
This generates a core with the following bt. Showing the top few frames only:
(gdb) bt
#0 0x0000000800acd3fc in thr_kill () at thr_kill.S:3
#1 0x0000000800b5e283 in abort () at /build/mnt/src/lib/libc/stdlib/abort.c:65
#2 0x0000000000494acf in Py_FatalError (msg=Variable "msg" is not available.
) at ./../Python/pythonrun.c:1646
#3 0x000000000044e740 in PyTuple_SetItem (op=0x80c6e6308, i=16, newitem=0x80a80d780) at ./../Objects/tupleobject.c:128
#4 0x0000000807298866 in _pysqlite_fetch_one_row (self=0x80b846e48) at _sqlite/cursor.c:402
#5 0x0000000807298bf5 in pysqlite_cursor_iternext (self=0x80b846e48) at _sqlite/cursor.c:898
#6 0x0000000000476943 in PyEval_EvalFrameEx (f=0x80a94d420, throwflag=Variable "throwflag" is not available.
) at ./../Python/ceval.c:2237
#7 0x000000000047acbf in PyEval_EvalFrameEx (f=0x80a94b820, throwflag=Variable "throwflag" is not available.
) at ./../Python/ceval.c:3765
#8 0x000000000047bf09 in PyEval_EvalCodeEx (co=0x808d2ac60, globals=Variable "globals" is not available.
) at ./../Python/ceval.c:2942
...
(gdb) fr 4
#4 0x0000000807298866 in _pysqlite_fetch_one_row (self=0x80b846e48) at _sqlite/cursor.c:402
402 PyTuple_SetItem(row, i, converted);
Current language: auto; currently c
(gdb) l
397 converted = buffer;
398 }
(gdb) p *(PyTupleObject *)row
$11 = {ob_refcnt = 2, ob_type = 0x60fee0, ob_size = 22, ob_item = {0x80a534030}}
'row' was allocated via PyTuple_New()
but, somehow its refcount has become 2 while setting the 16th item!!!
Is this a known issue? If not, what can I do to debug.
Thanks,
Pankaj
----------
messages: 163224
nosy: pxd
priority: normal
severity: normal
status: open
title: ERROR: SystemError: ./../Objects/tupleobject.c:118: bad argument to internal function
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15108>
_______________________________________
More information about the Python-bugs-list
mailing list