Skip to content

Commit

Permalink
Fixed an issue that resulted in errors on empty cachefiles, updated d…
Browse files Browse the repository at this point in the history
…ependencies
  • Loading branch information
fjwillemsen committed Jan 15, 2024
1 parent d47e96b commit c9ea211
Show file tree
Hide file tree
Showing 4 changed files with 945 additions and 949 deletions.
5 changes: 3 additions & 2 deletions kernel_tuner/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,11 +1173,12 @@ def read_cache(cache, open_cache=True):
filestr = cachefile.read().strip()

# if file was not properly closed, pretend it was properly closed
if not filestr[-3:] == "}\n}":
if len(filestr) > 0 and not filestr[-3:] == "}\n}":
# remove the trailing comma if any, and append closing brackets
if filestr[-1] == ",":
filestr = filestr[:-1]
filestr = filestr + "}\n}"
if len(filestr) > 0:
filestr = filestr + "}\n}"
else:
if open_cache:
# if it was properly closed, open it for appending new entries
Expand Down
Loading

0 comments on commit c9ea211

Please sign in to comment.