aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2020-11-08 13:59:28 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2020-11-08 19:10:48 +0200
commit5dd174c60b209aff2eef8fa38c12cc8a3c6753db (patch)
tree99b93c4f7c7f263c32746ea4ffbf2103e0ada6cf
parent3e6fbde94c1cb8d4e01b7daf0282c315ff0e6c7d (diff)
downloadmeson-5dd174c60b209aff2eef8fa38c12cc8a3c6753db.zip
meson-5dd174c60b209aff2eef8fa38c12cc8a3c6753db.tar.gz
meson-5dd174c60b209aff2eef8fa38c12cc8a3c6753db.tar.bz2
Fix "generator doesn't stop" on Windows
When TemporaryDirectory() cleans up on __exit__ it sometimes throws OSError noting that the dir isn't empty. This happens after the first yield in this generator and leads to the exception being handled which leads to a second yield. contextlib.contextmanager() fails then since the function it wraps is only allowed to yield once. Fix this by not yielding again in the error case. Fixes #7947
-rw-r--r--mesonbuild/compilers/compilers.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 6a54622..81d48d2 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -785,7 +785,7 @@ class Compiler(metaclass=abc.ABCMeta):
# On Windows antivirus programs and the like hold on to files so
# they can't be deleted. There's not much to do in this case. Also,
# catch OSError because the directory is then no longer empty.
- yield None
+ return
@contextlib.contextmanager
def cached_compile(self, code: str, cdata: coredata.CoreData, *,