Skip to content

Warning: Modules/_io/fileio.c:175:9: warning: ‘exc’ may be used uninitialized [-Wmaybe-uninitialized] #114286

@sobolevn

Description

@sobolevn

Bug report

This code produces a warning:

PyObject *exc;
if (res == NULL) {
exc = PyErr_GetRaisedException();
}
if (self->finalizing) {
PyObject *r = fileio_dealloc_warn(self, (PyObject *) self);
if (r) {
Py_DECREF(r);
}
else {
PyErr_Clear();
}
}
rc = internal_close(self);
if (res == NULL) {
_PyErr_ChainExceptions1(exc);
}

Link: https://buildbot.python.org/all/#/builders/1061/builds/695/steps/7/logs/warnings__145_

I think that it is enough to add = NULL; to PyObject *exc;.

Linked PRs

Metadata

Metadata

Assignees

Labels

extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions