--- a/mercurial/scmwindows.py Mon Aug 08 23:51:11 2016 +0530
+++ b/mercurial/scmwindows.py Wed Aug 10 04:35:44 2016 +0530
@@ -1,6 +1,5 @@
from __future__ import absolute_import
-import _winreg
import os
from . import (
@@ -8,6 +7,12 @@
util,
)
+try:
+ import _winreg as winreg
+ winreg.CloseKey
+except ImportError:
+ import winreg
+
def systemrcpath():
'''return default os-specific hgrc search path'''
rcpath = []
@@ -23,7 +28,7 @@
rcpath.append(os.path.join(progrcd, f))
# else look for a system rcpath in the registry
value = util.lookupreg('SOFTWARE\\Mercurial', None,
- _winreg.HKEY_LOCAL_MACHINE)
+ winreg.HKEY_LOCAL_MACHINE)
if not isinstance(value, str) or not value:
return rcpath
value = util.localpath(value)