This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author espie
Recipients espie
Date 2017-05-24.15:14:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1495638852.56.0.0790136948712.issue30459@psf.upfronthosting.co.za>
In-reply-to
Content
Documentation says PyList_SET_ITEM is void, but it lies. The macro is such that it yields the actual element being set.

wrapping the macro content in a do {} while (0)  makes sure PyList_SET_ITEM is really void, e.g.:
#define PyList_SET_ITEM(op, i, v) do { (((PyListObject *)(op))->ob_item[i] = (v)); } while (0)


I just ran into the problem while compiling py-qt4 with clang.
There was some confusion between PyList_SET_ITEM and PyList_SetItem:

if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0)

g++ didn't catch it (because it doesn't see negative pointers as a problem), but clang++ instantly broke.

With PyList_SET_ITEM truly void the problem disappears.
History
Date User Action Args
2017-05-24 15:14:12espiesetrecipients: + espie
2017-05-24 15:14:12espiesetmessageid: <1495638852.56.0.0790136948712.issue30459@psf.upfronthosting.co.za>
2017-05-24 15:14:12espielinkissue30459 messages
2017-05-24 15:14:12espiecreate