diff options
author | Benjamin Peterson <benjamin@python.org> | 2020-07-16 13:07:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-16 13:07:29 (GMT) |
commit | 2ad7e9c011b7606c5c7307176df07419a0e60134 (patch) | |
tree | b32a0787b34b987c469a5daecfb57f6052190859 /Python/compile.c | |
parent | 5e5c0f98667c9280c6d27b3db98a6cad2cc89077 (diff) | |
download | cpython-2ad7e9c011b7606c5c7307176df07419a0e60134.zip cpython-2ad7e9c011b7606c5c7307176df07419a0e60134.tar.gz cpython-2ad7e9c011b7606c5c7307176df07419a0e60134.tar.bz2 |
Fix possibly-unitialized warning in string_parser.c. (GH-21503)
GCC says
```
../cpython/Parser/string_parser.c: In function ‘fstring_find_expr’:
../cpython/Parser/string_parser.c:404:93: warning: ‘cols’ may be used uninitialized in this function [-Wmaybe-uninitialized]
404 | p2->starting_col_offset = p->tok->first_lineno == p->tok->lineno ? t->col_offset + cols : cols;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
../cpython/Parser/string_parser.c:384:16: note: ‘cols’ was declared here
384 | int lines, cols;
| ^~~~
../cpython/Parser/string_parser.c:403:45: warning: ‘lines’ may be used uninitialized in this function [-Wmaybe-uninitialized]
403 | p2->starting_lineno = t->lineno + lines - 1;
| ~~~~~~~~~~~~~~~~~~^~~
../cpython/Parser/string_parser.c:384:9: note: ‘lines’ was declared here
384 | int lines, cols;
| ^~~~~
```
and, indeed, if `PyBytes_AsString` somehow fails, lines & cols will not be initialized.
Diffstat (limited to 'Python/compile.c')
0 files changed, 0 insertions, 0 deletions