From a2a58a63f5feef245ea3825f5aba14f9967d52e3 Mon Sep 17 00:00:00 2001 From: Luis Montero <17201527+fd0r@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:28:37 +0200 Subject: [PATCH] fix: remove `ResourceWarning` from using `TemporaryDirectory` We currently have something like `var = TemporaryDirectory` without explicitly calling the `close` method on `var` thus raising a `ResourceWarning` when the resource is implicitely cleaned-up. This could be avoided by using `mkdtemp` instead. --- .../concrete-python/concrete/fhe/compilation/server.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frontends/concrete-python/concrete/fhe/compilation/server.py b/frontends/concrete-python/concrete/fhe/compilation/server.py index 5a13fdef97..d1905f31de 100644 --- a/frontends/concrete-python/concrete/fhe/compilation/server.py +++ b/frontends/concrete-python/concrete/fhe/compilation/server.py @@ -189,10 +189,8 @@ def create( if configuration.compiler_verbose_mode: # pragma: no cover set_compiler_logging(True) - # pylint: disable=consider-using-with - output_dir = tempfile.TemporaryDirectory() - output_dir_path = Path(output_dir.name) - # pylint: enable=consider-using-with + output_dir = tempfile.mkdtemp() + output_dir_path = Path(output_dir) support = LibrarySupport.new( str(output_dir_path), generateCppHeader=False, generateStaticLib=False