Skip to content

Commit

Permalink
TemporaryDirectory 3.11 compatibility support
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkarmacoma committed Jan 18, 2025
1 parent 198ecd2 commit 2816ed5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/halmos/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,18 @@ def __post_init__(self):
prefix = (
f"{self.info.name}-"
if self.info.name
else f"{self.contract_ctx.name}-deploy-"
else f"{self.contract_ctx.name}-constructor-"
)

# if the user explicitly enabled dumping, we don't want to delete the directory on exit
delete = not self.args.dump_smt_queries
dump_dir = TemporaryDirectory(
prefix=prefix, ignore_cleanup_errors=True, delete=delete
)

# ideally we would pass `delete=delete` to the constructor, but it's in >=3.12
dump_dir = TemporaryDirectory(prefix=prefix, ignore_cleanup_errors=True)

# If user wants to keep the files, prevent cleanup on exit
if not delete:
dump_dir._finalizer.detach()

if args.verbose >= 1 or args.dump_smt_queries:
print(f"Generating SMT queries in {dump_dir.name}")
Expand Down

0 comments on commit 2816ed5

Please sign in to comment.