[PATCH STABLE] demandimport: explicitly declare `_session` at the module level

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Aug 8 09:06:57 UTC 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1565255173 -7200
#      Thu Aug 08 11:06:13 2019 +0200
# Branch stable
# Node ID c88fca729396738dafa233416d093e711bfb3532
# Parent  cba59b338976af0e4c92cf16b8f95331e6ac4f30
# EXP-Topic pyflakes-tracing
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c88fca729396
demandimport: explicitly declare `_session` at the module level

The `_session` module level variable is set within a function using the `global`
keyword. This confuse my `test-check-pyflakes.t`. Explicitly declaring the
variable at the top level solve the issue (and seems absolutely reasonable).

diff --git a/hgdemandimport/tracing.py b/hgdemandimport/tracing.py
--- a/hgdemandimport/tracing.py
+++ b/hgdemandimport/tracing.py
@@ -12,6 +12,7 @@ import os
 
 _pipe = None
 _checked = False
+_session = 'none'
 
 def _isactive():
     global _pipe, _session, _checked


More information about the Mercurial-devel mailing list