Skip to content

New warning: "‘subobj’ may be used uninitialized in this function" in Objects/bytes_methods.c #102941

Closed
@sobolevn

Description

@sobolevn

Example:
Снимок экрана 2023-03-23 в 12 05 59

This looks like a false-positive, because subobj is always initialized in stringlib_parse_args_finds(function_name, args, &subobj, &start, &end):

static PyObject *
_Py_bytes_tailmatch(const char *str, Py_ssize_t len,
const char *function_name, PyObject *args,
int direction)
{
Py_ssize_t start = 0;
Py_ssize_t end = PY_SSIZE_T_MAX;
PyObject *subobj;
int result;
if (!stringlib_parse_args_finds(function_name, args, &subobj, &start, &end))
return NULL;
if (PyTuple_Check(subobj)) {
Py_ssize_t i;
for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) {
result = tailmatch(str, len, PyTuple_GET_ITEM(subobj, i),
start, end, direction);

Morever, it is used before in PyTuple_Check(subobj).

Any ideas on how to fix / silence it?
And why we get this warning only now? The code was not changed for 10 months.

Linked PRs

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions