Skip to content

run_presite's error handling is wrong #115503

Closed

Description

@sobolevn

Bug report

cpython/Python/pylifecycle.c

Lines 1106 to 1113 in 4742047

PyObject *presite_modname = PyUnicode_FromWideChar(
config->run_presite,
wcslen(config->run_presite)
);
if (presite_modname == NULL) {
fprintf(stderr, "Could not convert pre-site module name to unicode\n");
Py_DECREF(presite_modname);
}

I think that Py_DECREF(presite_modname); is not needed, because presite_modname is NULL in this branch.

This will, likely, lead to a crash.
I have a PR ready.

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    on Feb 15, 2024
  2. self-assigned this
    on Feb 15, 2024
  3. added 2 commits that reference this issue on Feb 15, 2024
  4. added a commit that references this issue on Mar 4, 2024
  5. added a commit that references this issue on Apr 17, 2024
  6. added a commit that references this issue on Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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