diff --git a/src/find_libpython/__init__.py b/src/find_libpython/__init__.py index eded7af..d523143 100644 --- a/src/find_libpython/__init__.py +++ b/src/find_libpython/__init__.py @@ -147,7 +147,8 @@ def wrapper(*args: P.args, **kwds: P.kwargs) -> Iterable[str]: def _get_proc_library() -> Iterable[str]: pid = os.getpid() path = f"/proc/{pid}/maps" - lines = open(path).readlines() + with open(path) as f: + lines = f.readlines() for line in lines: path = line.split(" ", 5)[5].strip()