mercurial/util.py
changeset 48010 ae79611e3115
parent 47622 bb917eea1605
child 48013 376d08ae904f
--- a/mercurial/util.py	Mon Sep 20 10:45:18 2021 -0400
+++ b/mercurial/util.py	Mon Sep 20 10:46:35 2021 -0400
@@ -449,8 +449,8 @@
         return b''
     elif size is None:
         size = 0
+    fd = getattr(fp, 'fileno', lambda: fp)()
     try:
-        fd = getattr(fp, 'fileno', lambda: fp)()
         return mmap.mmap(fd, size, access=mmap.ACCESS_READ)
     except ValueError:
         # Empty files cannot be mmapped, but mmapread should still work.  Check