Skip to content

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

Closed

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

Activity

  1. added
    type-bug
    extension-modules
    on Jan 19, 2024
  2. self-assigned this
    on Jan 19, 2024
  3. added a commit that references this issue on Jan 19, 2024
  4. added a commit that references this issue on Jan 19, 2024
  5. added a commit that references this issue on Jan 19, 2024
  6. added a commit that references this issue on Jan 19, 2024
  7. added a commit that references this issue on Jan 22, 2024
  8. added a commit that references this issue on Feb 11, 2024
  9. added a commit that references this issue on Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

extension-modulestype-bug

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions