From patchwork Thu Aug 8 09:06:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [STABLE] demandimport: explicitly declare `_session` at the module level From: Pierre-Yves David X-Patchwork-Id: 41222 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Thu, 08 Aug 2019 11:06:57 +0200 # HG changeset patch # User Pierre-Yves David # 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