Message286903
Not a big deal, but the change produces compiler warnings with GCC 6.1.1:
/home/proj/python/cpython/Objects/bytesobject.c: In function ‘bytes_subscript’:
/home/proj/python/cpython/Objects/bytesobject.c:1701:13: warning: ‘slicelength’ may be used uninitialized in this function [-Wmaybe-uninitialized]
for (cur = start, i = 0; i < slicelength;
^~~
/home/proj/python/cpython/Objects/listobject.c: In function ‘list_ass_subscript’:
/home/proj/python/cpython/Objects/listobject.c:2602:13: warning: ‘slicelength’ may be used uninitialized in this function [-Wmaybe-uninitialized]
for (i = 0; i < slicelength; i++) {
^~~
/home/proj/python/cpython/Objects/unicodeobject.c: In function ‘unicode_subscript’:
/home/proj/python/cpython/Objects/unicodeobject.c:14013:16: warning: ‘slicelength’ may be used uninitialized in this function [-Wmaybe-uninitialized]
result = PyUnicode_New(slicelength, max_char);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/disk/home/proj/python/cpython/Modules/_elementtree.c: In function ‘element_ass_subscr’:
/media/disk/home/proj/python/cpython/Modules/_elementtree.c:1896:50: warning: ‘slicelen’ may be used uninitialized in this function [-Wmaybe-uninitialized]
self->extra->children[i + newlen - slicelen] = self->extra->children[i];
~~~~~~~~~~~^~~~~~~~~~
/media/disk/home/proj/python/cpython/Modules/_ctypes/_ctypes.c: In function ‘Array_subscript’:
/media/disk/home/proj/python/cpython/Modules/_ctypes/_ctypes.c:4327:16: warning: ‘slicelen’ may be used uninitialized in this function [-Wmaybe-uninitialized]
np = PyUnicode_FromWideChar(dest, slicelen);
~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My build used to be free of warnings. This warning is enabled via -Wall. The reason is probably that the new macro skips the slicelength assignment if PySlice_Unpack() fails. Workarounds could be to assign or initialize slicelength to zero (at the call sites or inside the macro), or to compile with -Wno-maybe-uninitialized. |
|
Date |
User |
Action |
Args |
2017-02-04 01:37:10 | martin.panter | set | recipients:
+ martin.panter, terry.reedy, mark.dickinson, ncoghlan, vstinner, python-dev, serhiy.storchaka, tehybel |
2017-02-04 01:37:10 | martin.panter | set | messageid: <1486172230.07.0.707771558892.issue27867@psf.upfronthosting.co.za> |
2017-02-04 01:37:09 | martin.panter | link | issue27867 messages |
2017-02-04 01:37:08 | martin.panter | create | |
|