[PATCH 7 of 7] profile: properly propagate exception from the sub-context manager
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon Jun 12 12:17:51 EDT 2017
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1497281050 -7200
# Mon Jun 12 17:24:10 2017 +0200
# Node ID 2a4ee2a67d3f003ac2cbe1cf7f8cf5c7adf83efa
# Parent b398563a8ca6167ceb94a2bdc19bdcdb92162636
# EXP-Topic profile
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
# hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 2a4ee2a67d3f
profile: properly propagate exception from the sub-context manager
Context manager has a mechanism to control extension propagation. It is not
used by profiling right now, but making the code correct will help prevent bug
in the future.
diff --git a/mercurial/profiling.py b/mercurial/profiling.py
--- a/mercurial/profiling.py
+++ b/mercurial/profiling.py
@@ -214,8 +214,10 @@ class profile(object):
raise
def __exit__(self, exception_type, exception_value, traceback):
+ propagate = None
if self._profiler is not None:
- self._profiler.__exit__(exception_type, exception_value, traceback)
+ propagate = self._profiler.__exit__(exception_type, exception_value,
+ traceback)
if self._output == 'blackbox':
val = 'Profile:\n%s' % self._fp.getvalue()
# ui.log treats the input as a format string,
@@ -223,6 +225,7 @@ class profile(object):
val = val.replace('%', '%%')
self._ui.log('profile', val)
self._closefp()
+ return propagate
def _closefp(self):
if self._fpdoclose and self._fp is not None:
More information about the Mercurial-devel
mailing list