[issue30459] PyList_SET_ITEM could be safer

2020-12-05 Thread Espie Marc
Espie Marc added the comment: On Sat, Dec 05, 2020 at 01:28:33AM +, STINNER Victor wrote: > > STINNER Victor added the comment: > > I propose to merge my PR 23645 change right now. If it breaks too many C > extensions, we still have time before Python 3.10.0 fin

[issue30459] PyList_SET_ITEM could be safer

2017-05-25 Thread Espie Marc
Espie Marc added the comment: it's still 100% safe as a macro since each parameter is not used more than once. only the return type is an issue. -- ___ Python tracker <http://bugs.python.org/is

[issue30459] PyList_SET_ITEM could be safer

2017-05-25 Thread Espie Marc
Espie Marc added the comment: Note that the API is fully documented for returning void... not anything else. "No basis" right. We're taling 1 pieces of software. a lot of what is actually used in the world. I'm very surprised, considering python has routinely done

[issue30459] PyList_SET_ITEM could be safer

2017-05-25 Thread Espie Marc
Espie Marc added the comment: yep, casting to (void) would be safer indeed. didn't think of that one ;) -- ___ Python tracker <http://bugs.python.org/is

[issue30459] PyList_SET_ITEM could be safer

2017-05-25 Thread Espie Marc
Espie Marc added the comment: Well, there is not going to be a lot of breakage. This problem is the only instance I've encountered in the full OpenBSD ports tree. I thought python was supposed to be a clean language, and didn't shy away from removing stuff/tweaking stuff to achieve

[issue30459] PyList_SET_ITEM could be safer

2017-05-24 Thread Espie Marc
New submission from Espie Marc: 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