changeset 45452:dd9e28612468

resourceutil: document when we expect to take the importlib.resouces code path Differential Revision: https://phab.mercurial-scm.org/D9018
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 12 Sep 2020 11:18:12 -0700
parents e53a3d0ef416
children 39ddb1121c4e
files mercurial/utils/resourceutil.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/resourceutil.py	Thu Sep 10 22:00:00 2020 -0700
+++ b/mercurial/utils/resourceutil.py	Sat Sep 12 11:18:12 2020 -0700
@@ -55,6 +55,8 @@
 
 
 try:
+    # importlib.resources exists from Python 3.7; see fallback in except clause
+    # further down
     from importlib import resources
 
     from .. import encoding
@@ -78,6 +80,8 @@
 
 
 except (ImportError, AttributeError):
+    # importlib.resources was not found (almost definitely because we're on a
+    # Python version before 3.7)
 
     def open_resource(package, name):
         path = os.path.join(_package_path(package), name)