diff mercurial/posix.py @ 49305:53e9422a9b45

py3: catch FileExistsError instead of checking errno == EEXIST
author Manuel Jacob <me@manueljacob.de>
date Tue, 31 May 2022 21:16:17 +0200
parents ee4537e365c8
children 2e726c934fcd
line wrap: on
line diff
--- a/mercurial/posix.py	Tue May 31 16:54:58 2022 +0200
+++ b/mercurial/posix.py	Tue May 31 21:16:17 2022 +0200
@@ -329,11 +329,9 @@
                     except OSError:
                         unlink(name)
                 return True
-            except OSError as inst:
+            except FileExistsError:
                 # link creation might race, try again
-                if inst.errno == errno.EEXIST:
-                    continue
-                raise
+                continue
             finally:
                 if fd is not None:
                     fd.close()