Skip to content

Commit 8d1aecb

Browse files
committed
feat: catch only TypeError exceptions from hashlib
<=Python 3.8 does not have `usedforsecurity` and will raise an exception
1 parent a0955bc commit 8d1aecb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fortls/parse_fortran.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,8 @@ def load_from_disk(self) -> tuple[str | None, bool | None]:
876876
hash = hashlib.md5(
877877
contents.encode("utf-8"), usedforsecurity=False
878878
).hexdigest()
879-
except:
879+
# Python <=3.8 does not have the `usedforsecurity` option
880+
except TypeError:
880881
hash = hashlib.md5(contents.encode("utf-8")).hexdigest()
881882

882883
if hash == self.hash:

0 commit comments

Comments
 (0)