[Updated] D11310: template: FileNotFoundError is actually a built in exception

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Sun Aug 22 20:37:13 UTC 2021


Closed by commit rHG2b76255a4f74: template: FileNotFoundError is actually a built in exception (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11310?vs=29959&id=29983

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11310/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11310

AFFECTED FILES
  mercurial/pycompat.py
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -71,7 +71,10 @@
 import os
 
 from .i18n import _
-from .pycompat import getattr
+from .pycompat import (
+    FileNotFoundError,
+    getattr,
+)
 from . import (
     config,
     encoding,
@@ -856,7 +859,7 @@
                     subresource = resourceutil.open_resource(
                         b'mercurial.templates', rel
                     )
-                except resourceutil.FileNotFoundError:
+                except FileNotFoundError:
                     subresource = None
             else:
                 dir = templatedir()
diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -40,6 +40,8 @@
     def future_set_exception_info(f, exc_info):
         f.set_exception_info(*exc_info)
 
+    # this is close enough for our usage
+    FileNotFoundError = OSError
 
 else:
     import concurrent.futures as futures
@@ -53,6 +55,8 @@
     def future_set_exception_info(f, exc_info):
         f.set_exception(exc_info[0])
 
+    FileNotFoundError = __builtins__['FileNotFoundError']
+
 
 def identity(a):
     return a



To: marmoute, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210822/adbc561f/attachment-0002.html>


More information about the Mercurial-patches mailing list