compiler.py: early return in compiler_environment when no modules (#29441)

This commit is contained in:
Harmen Stoppels 2022-03-14 12:27:49 +01:00 committed by GitHub
parent ccfaec7b1c
commit 474493713b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -598,6 +598,11 @@ def __str__(self):
@contextlib.contextmanager @contextlib.contextmanager
def compiler_environment(self): def compiler_environment(self):
# yield immediately if no modules
if not self.modules:
yield
return
# store environment to replace later # store environment to replace later
backup_env = os.environ.copy() backup_env = os.environ.copy()