Skip to content

Commit

Permalink
fix: remove ResourceWarning from using TemporaryDirectory
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fd0r committed Apr 23, 2024
1 parent e238067 commit a2a58a6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions frontends/concrete-python/concrete/fhe/compilation/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a2a58a6

Please sign in to comment.