mercurial/windows.py
changeset 40266 ab04ce6f0674
parent 39910 6e2c8f7f894e
child 40937 e11e03f72baf
--- a/mercurial/windows.py	Sat Oct 13 16:57:28 2018 +0200
+++ b/mercurial/windows.py	Fri Oct 12 17:34:45 2018 -0400
@@ -583,7 +583,8 @@
     for s in scope:
         try:
             with winreg.OpenKey(s, encoding.strfromlocal(key)) as hkey:
-                val = winreg.QueryValueEx(hkey, valname)[0]
+                name = valname and encoding.strfromlocal(valname) or valname
+                val = winreg.QueryValueEx(hkey, name)[0]
                 # never let a Unicode string escape into the wild
                 return encoding.unitolocal(val)
         except EnvironmentError: