statprof: don't leak a file descriptor when loading data files
I wanted to use `util.readfiles()` here, but it looks like very little core code
is imported, and I assume that's by design?
--- a/mercurial/statprof.py Tue Dec 17 01:31:17 2024 -0500
+++ b/mercurial/statprof.py Tue Dec 17 01:35:52 2024 -0500
@@ -397,7 +397,8 @@
def load_data(path):
- lines = open(path, 'rb').read().splitlines()
+ with open(path, 'rb') as fp:
+ lines = fp.read().splitlines()
state.accumulated_time = [float(value) for value in lines[0].split()]
state.samples = []