changeset 33587:c0b2c8f25ad9

profiling: move 'fp' closing logic into its own function We are about to make the logic more robust and reuse it in more place, we start by isolating what we have.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 12 Jun 2017 17:13:35 +0200
parents 90ce5f0366ba
children 2b0fc56840d0
files mercurial/profiling.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/profiling.py
+++ b/mercurial/profiling.py
@@ -218,4 +218,7 @@
                 # so we need to escape any % signs.
                 val = val.replace('%', '%%')
                 self._ui.log('profile', val)
-            self._fp.close()
+            self._closefp()
+
+    def _closefp(self):
+        self._fp.close()