From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 2 Jun 2021 23:50:55 +0000 (-0700) Subject: bpo-44285: getpath.c: Assert that env_file is NULL during an error check (GH-26486... X-Git-Tag: v3.9.6~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=85b587a38dcf5d0ef1e275510001e22425d65977;p=thirdparty%2FPython%2Fcpython.git bpo-44285: getpath.c: Assert that env_file is NULL during an error check (GH-26486) (GH-26496) This was flagged by a static analyzer, but the logic of why this is NULL on error is hard to follow for humans as well. (cherry picked from commit bdb56902a3bfe12b10f85a941d5dd0eae739f1a8) Co-authored-by: stratakis --- diff --git a/Modules/getpath.c b/Modules/getpath.c index 40358190a71b..728ecad052e1 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -1263,6 +1263,7 @@ calculate_read_pyenv(PyCalculatePath *calculate) status = calculate_open_pyenv(calculate, &env_file); if (_PyStatus_EXCEPTION(status)) { + assert(env_file == NULL); return status; } if (env_file == NULL) {