changeset 37978:2d919ab6c5b4

posix: use inst.errno instead of inst[0] on OSError instances Differential Revision: https://phab.mercurial-scm.org/D3523
author Augie Fackler <augie@google.com>
date Fri, 27 Apr 2018 13:26:43 -0400
parents f71c97d9b97b
children 630429dcc397
files mercurial/posix.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Fri Apr 27 13:17:24 2018 -0400
+++ b/mercurial/posix.py	Fri Apr 27 13:26:43 2018 -0400
@@ -287,7 +287,7 @@
                 return True
             except OSError as inst:
                 # link creation might race, try again
-                if inst[0] == errno.EEXIST:
+                if inst.errno == errno.EEXIST:
                     continue
                 raise
             finally:
@@ -297,7 +297,7 @@
             return False
         except OSError as inst:
             # sshfs might report failure while successfully creating the link
-            if inst[0] == errno.EIO and os.path.exists(name):
+            if inst.errno == errno.EIO and os.path.exists(name):
                 unlink(name)
             return False