Patchwork D7452: debugextensions: gracefully handle missing __file__ attributes

login
register
mail settings
Submitter phabricator
Date Nov. 17, 2019, 11:33 p.m.
Message ID <bbd08453d77123fd0fd399030158105f@localhost.localdomain>
Download mbox | patch
Permalink /patch/43327/
State Not Applicable
Headers show

Comments

phabricator - Nov. 17, 2019, 11:33 p.m.
Closed by commit rHGf1dabf99db17: debugextensions: gracefully handle missing __file__ attributes (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7452?vs=18205&id=18207

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7452/new/

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1029,7 +1029,12 @@ 
     fm = ui.formatter(b'debugextensions', opts)
     for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
         isinternal = extensions.ismoduleinternal(extmod)
-        extsource = pycompat.fsencode(extmod.__file__)
+        extsource = None
+
+        if util.safehasattr(extmod, '__file__'):
+            extsource = pycompat.fsencode(extmod.__file__)
+        elif getattr(sys, 'oxidized', False):
+            extsource = pycompat.sysexecutable
         if isinternal:
             exttestedwith = []  # never expose magic string to users
         else: