From c38960735411775b72f3a3da24e17cefd0987052 Mon Sep 17 00:00:00 2001 From: stratakis Date: Wed, 2 Jun 2021 16:54:33 +0200 Subject: [PATCH] bpo-44285: getpath.c: Assert that env_file is NULL during an error check (GH-26486) 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 --- Modules/getpath.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/getpath.c b/Modules/getpath.c index 40358190a71b87..728ecad052e142 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) {