largefiles: use `stat_result.st_size` instead of a magic tuple index
authorMatt Harbison <matt_harbison@yahoo.com>
Mon, 16 Dec 2024 20:40:04 -0500
changeset 52563 30f81efce00b
parent 52562 5dcf40af7c2d
child 52564 7da165194128
largefiles: use `stat_result.st_size` instead of a magic tuple index
hgext/largefiles/proto.py
--- a/hgext/largefiles/proto.py	Mon Dec 16 20:38:13 2024 -0500
+++ b/hgext/largefiles/proto.py	Mon Dec 16 20:40:04 2024 -0500
@@ -74,7 +74,7 @@
 
     # TODO: fix the fd leak here
     f = open(filename, 'rb')
-    length = os.fstat(f.fileno())[6]
+    length = os.fstat(f.fileno()).st_size
 
     # Since we can't set an HTTP content-length header here, and
     # Mercurial core provides no way to give the length of a streamres