Patchwork D6523: demandimport: add tracing coverage for Python 3

login
register
mail settings
Submitter phabricator
Date June 14, 2019, 11:16 p.m.
Message ID <499133a127770ba13f5f65b144eb50f1@localhost.localdomain>
Download mbox | patch
Permalink /patch/40521/
State Not Applicable
Headers show

Comments

phabricator - June 14, 2019, 11:16 p.m.
Closed by commit rHGadb636392b3f: demandimport: add tracing coverage for Python 3 (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6523?vs=15475&id=15523

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

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

AFFECTED FILES
  hgdemandimport/demandimportpy3.py

CHANGE DETAILS




To: durin42, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/hgdemandimport/demandimportpy3.py b/hgdemandimport/demandimportpy3.py
--- a/hgdemandimport/demandimportpy3.py
+++ b/hgdemandimport/demandimportpy3.py
@@ -32,6 +32,8 @@ 
 import importlib.util
 import sys
 
+from . import tracing
+
 _deactivated = False
 
 class _lazyloaderex(importlib.util.LazyLoader):
@@ -40,10 +42,11 @@ 
     """
     def exec_module(self, module):
         """Make the module load lazily."""
-        if _deactivated or module.__name__ in ignores:
-            self.loader.exec_module(module)
-        else:
-            super().exec_module(module)
+        with tracing.log('demandimport %s', module):
+            if _deactivated or module.__name__ in ignores:
+                self.loader.exec_module(module)
+            else:
+                super().exec_module(module)
 
 # This is 3.6+ because with Python 3.5 it isn't possible to lazily load
 # extensions. See the discussion in https://bugs.python.org/issue26186 for more.