# HG changeset patch # User Matt Harbison # Date 2021-04-13 03:31:54 # Node ID 9c3e8456907178b2160e180e0a07b49292bc91c1 # Parent b5e8bf10436e24a111ec48a7a28edddf43fa12d6 re2: adjust local variable assignment scope Pytype flagged the exception handler where these are used as `[name-error]`, and PyCharm complained they may be used before assignment. Differential Revision: https://phab.mercurial-scm.org/D10376 diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -2189,10 +2189,11 @@ class _re(object): def _checkre2(self): global _re2 global _re2_input + + check_pattern = br'\[([^\[]+)\]' + check_input = b'[ui]' try: # check if match works, see issue3964 - check_pattern = br'\[([^\[]+)\]' - check_input = b'[ui]' _re2 = bool(re2.match(check_pattern, check_input)) except ImportError: _re2 = False