comparison mercurial/windows.py @ 40266:ab04ce6f0674

py3: use str to query registry values on Windows This blew up launching any command if extdiff processed a tool with a regkey config.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 12 Oct 2018 17:34:45 -0400
parents 6e2c8f7f894e
children e11e03f72baf
comparison
equal deleted inserted replaced
40265:d6b7c4e77bb4 40266:ab04ce6f0674
581 elif not isinstance(scope, (list, tuple)): 581 elif not isinstance(scope, (list, tuple)):
582 scope = (scope,) 582 scope = (scope,)
583 for s in scope: 583 for s in scope:
584 try: 584 try:
585 with winreg.OpenKey(s, encoding.strfromlocal(key)) as hkey: 585 with winreg.OpenKey(s, encoding.strfromlocal(key)) as hkey:
586 val = winreg.QueryValueEx(hkey, valname)[0] 586 name = valname and encoding.strfromlocal(valname) or valname
587 val = winreg.QueryValueEx(hkey, name)[0]
587 # never let a Unicode string escape into the wild 588 # never let a Unicode string escape into the wild
588 return encoding.unitolocal(val) 589 return encoding.unitolocal(val)
589 except EnvironmentError: 590 except EnvironmentError:
590 pass 591 pass
591 592