Myron Walker added the comment:
I think this usage of 'call_method' from typeobject.c would cause it to leak.
static PyObject*
slot_sq_slice(PyObject *self, Py_ssize_t i, Py_ssize_t j)
{
static PyObject *getslice_str;
if (PyErr_WarnPy3k("in 3.x, __getslice__ has been removed; "
"use __getitem__", 1) < 0)
return NULL;
return call_method(self, "__getslice__", &getslice_str,
"nn", i, j); <<<<<<< Maybe Bad Format Str <<<<<<<
}
Looks like the only place in 'call_method' that could cause args to be NULL is
if 'Py_VaBuildValue' which calls 'va_build_value' returns NULL.
'va_build_value' calls 'countformat' on the format string and 'countformat'
looks for some escaping in the format string. If no special format characters
like '(' or '{' are not found, then the count might be incremented but when the
NULL terminator on the end of the string is hit, the 'countformat' will return
-1.
So I believe this method has a bug because it doesn't look to be using the
formatter correctly and also it looks like it might cause a leak.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25716>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com