[Request] [+ ] D11310: template: FileNotFoundError is actually a built in exception
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Thu Aug 19 18:12:33 UTC 2021
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
However it is python3 only.
REPOSITORY
rHG Mercurial
BRANCH
stable
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, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210819/2015cc74/attachment.html>
More information about the Mercurial-patches
mailing list