aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2020-11-08 13:59:28 +0100
committerNirbheek Chauhan <nirbheek@centricular.com>2021-01-06 14:52:26 +0530
commit584daea0f3c43ff3a8be320fc533c698d714057b (patch)
tree0453da66ad65fda83d8bc86558f2f8e47e1c651f
parentb17972d4bf8f3fff54b3bb9ada5b2c9e7ccbc35b (diff)
downloadmeson-584daea0f3c43ff3a8be320fc533c698d714057b.zip
meson-584daea0f3c43ff3a8be320fc533c698d714057b.tar.gz
meson-584daea0f3c43ff3a8be320fc533c698d714057b.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 0f074bb..4e9b86b 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, *,