[Request] [+ ] D8902: templater: replace Py3-only exception types by super-types available in Py2

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Aug 6 05:27:40 UTC 2020


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  As noted by @indygreg, `test-check-pyflakes.t` started failing on Py2
  after my recent D8894 <https://phab.mercurial-scm.org/D8894>, because that introduced catching of the
  Py3-only types `ModuleNotFoundError` and `FileNotFoundError`. Let's
  switch to less precise types that are also available in Py2.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1107,5 +1107,5 @@
                 name,
                 resourceutil.open_resource(package_name, name_parts[-1]),
             )
-        except (ModuleNotFoundError, FileNotFoundError):
+        except (ImportError, OSError):
             return None, None



To: martinvonz, #hg-reviewers
Cc: indygreg, mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200806/794b3fbb/attachment-0001.html>


More information about the Mercurial-patches mailing list