# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 2022-05-31 21:41:15
# Node ID d2adebe35635ae241bd3d8b6caa1bbbeb803453c
# Parent  6f2a57ba2d13469236705fbcdada5c0255f9ac58

py3: catch PermissionError instead of checking errno == EPERM

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2503,12 +2503,10 @@ class filestat:
         advanced = (old.stat[stat.ST_MTIME] + 1) & 0x7FFFFFFF
         try:
             os.utime(path, (advanced, advanced))
-        except OSError as inst:
-            if inst.errno == errno.EPERM:
-                # utime() on the file created by another user causes EPERM,
-                # if a process doesn't have appropriate privileges
-                return False
-            raise
+        except PermissionError:
+            # utime() on the file created by another user causes EPERM,
+            # if a process doesn't have appropriate privileges
+            return False
         return True
 
     def __ne__(self, other):