mercurial/utils/resourceutil.py
changeset 49074 4ba27acdea63
parent 48875 6000f5b25c9b
child 49943 330d88217b83
--- a/mercurial/utils/resourceutil.py	Wed Apr 13 14:25:13 2022 -0400
+++ b/mercurial/utils/resourceutil.py	Wed Apr 13 14:37:57 2022 -0400
@@ -61,6 +61,10 @@
     # Force loading of the resources module
     resources.open_binary  # pytype: disable=module-attr
 
+    # py2exe raises an AssertionError if uses importlib.resources
+    if getattr(sys, "frozen", None) in ("console_exe", "windows_exe"):
+        raise ImportError
+
 except (ImportError, AttributeError):
     # importlib.resources was not found (almost definitely because we're on a
     # Python version before 3.7)