Martin Panter added the comment:
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.
----------
nosy: +martin.panter
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27867>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com