classification
Title: type_set_bases() doesn't check return value of PyArg_UnpackTuple()
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, ronaldoussoren
Priority: low Keywords:

Created on 2013-07-25 16:50 by christian.heimes, last changed 2013-07-26 21:59 by christian.heimes. This issue is now closed.

Messages (3)
msg193702 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-25 16:50
http://hg.python.org/cpython/file/be5f1f0bea09/Objects/typeobject.c#l554

CID 486265 (#1 of 1): Unchecked return value (CHECKED_RETURN)
19. check_return: Calling function "PyArg_UnpackTuple(PyObject *, char const *, Py_ssize_t, Py_ssize_t, ...)" without checking return value (as is done elsewhere 64 out of 65 times).
            PyArg_UnpackTuple(PyList_GET_ITEM(temp, i),
                              "", 2, 2, &cls, &mro);
msg193726 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-07-26 08:00
This appears to be harmless. The contents of the "temp" list are added by mro_subclasses, and that function only adds tuples of 2 elements. That means that the call to PyArg_UnpackTuple cannot fail.

It might be better to explicitly document this, either using an assert() or by calling Py_FatalError.
msg193727 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-26 11:17
Ah, you are right! Good catch :)

I have marked CID 486265 as intentional / ignore.
History
Date User Action Args
2013-07-26 21:59:25christian.heimessetstatus: open -> closed
resolution: wont fix
stage: resolved
2013-07-26 11:17:06christian.heimessetpriority: normal -> low

messages: + msg193727
stage: needs patch -> (no value)
2013-07-26 08:00:08ronaldoussorensetnosy: + ronaldoussoren
messages: + msg193726
2013-07-25 16:50:40christian.heimescreate