mharbison72 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
REVISION SUMMARY These were flagged by pytype 2022.03.21. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12401 AFFECTED FILES mercurial/scmwindows.py mercurial/windows.py CHANGE DETAILS diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -676,14 +676,21 @@ LOCAL_MACHINE). """ if scope is None: + # pytype: disable=module-attr scope = (winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE) + # pytype: enable=module-attr elif not isinstance(scope, (list, tuple)): scope = (scope,) for s in scope: try: + # pytype: disable=module-attr with winreg.OpenKey(s, encoding.strfromlocal(key)) as hkey: + # pytype: enable=module-attr name = valname and encoding.strfromlocal(valname) or valname + # pytype: disable=module-attr val = winreg.QueryValueEx(hkey, name)[0] + # pytype: enable=module-attr + # never let a Unicode string escape into the wild return encoding.unitolocal(val) except EnvironmentError: diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py --- a/mercurial/scmwindows.py +++ b/mercurial/scmwindows.py @@ -52,7 +52,11 @@ # next look for a system rcpath in the registry value = util.lookupreg( - b'SOFTWARE\\Mercurial', None, winreg.HKEY_LOCAL_MACHINE + # pytype: disable=module-attr + b'SOFTWARE\\Mercurial', + None, + winreg.HKEY_LOCAL_MACHINE + # pytype: enable=module-attr ) if value and isinstance(value, bytes): value = util.localpath(value) To: mharbison72, #hg-reviewers Cc: mercurial-patches, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel