Meador Inge <mead...@gmail.com> added the comment: This patch seems reasonable. Upon looking at the code in more detail, however, I can't see how the error condition that leaks the reference can ever by triggered. In particular, the following code from the 'PyCArrayType_from_ctype' function:
if (!PyType_Check(itemtype)) { PyErr_SetString(PyExc_TypeError, "Expected a type object"); return NULL; } 'PyCArrayType_from_ctype' is only called from 'CDataType_repeat'. The 'CDataType_repeat' function is only used to implement the 'sq_repeat' slot in 'CDataType_as_sequence'. 'CDataType_as_sequence' is used in all of the implemented ctypes (struct, array, union, simple, ...). Unless 'PyCArrayType_from_ctype' is called through some other means (it is public), then 'itemtype' should *always* be a type. Or am I missing something obvious? So, we could add the decref or just remove the type check code all together (and make 'PyCArrayType_from_ctype' private). ---------- nosy: +amaury.forgeotdarc, belopolsky _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13013> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com