]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44285: getpath.c: Assert that env_file is NULL during an error check (GH-26486...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 2 Jun 2021 23:50:55 +0000 (16:50 -0700)
committerGitHub <noreply@github.com>
Wed, 2 Jun 2021 23:50:55 +0000 (01:50 +0200)
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 <cstratak@redhat.com>
Modules/getpath.c

index 40358190a71b875379f0c8cca9583ddec0b942a3..728ecad052e142dd1433ee8da361f8a60e6ece30 100644 (file)
@@ -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) {