Patchwork D11311: resources: stop important a non existent FileNotFoundError

login
register
mail settings
Submitter phabricator
Date Aug. 19, 2021, 6:12 p.m.
Message ID <differential-rev-PHID-DREV-dxqmgzkzoo5gvgq66qcp-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49624/
State Superseded
Headers show

Comments

phabricator - Aug. 19, 2021, 6:12 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The error was hidden by the wide try/except

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/utils/resourceutil.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py
--- a/mercurial/utils/resourceutil.py
+++ b/mercurial/utils/resourceutil.py
@@ -64,11 +64,6 @@ 
     # Force loading of the resources module
     resources.open_binary  # pytype: disable=module-attr
 
-    # pytype: disable=import-error
-    from importlib.resources import FileNotFoundError
-
-    # pytype: enable=import-error
-
     def open_resource(package, name):
         return resources.open_binary(  # pytype: disable=module-attr
             pycompat.sysstr(package), pycompat.sysstr(name)
@@ -90,9 +85,6 @@ 
     # importlib.resources was not found (almost definitely because we're on a
     # Python version before 3.7)
 
-    class FileNotFoundError(RuntimeError):
-        pass
-
     def open_resource(package, name):
         path = os.path.join(_package_path(package), name)
         return open(path, "rb")