Added __enter__ and __exit__ functions to HKEY object
Added ExpandEnvironmentStrings to the _winreg module.
diff --git a/Doc/library/_winreg.rst b/Doc/library/_winreg.rst
index 7a5aa38..2544b5a 100644
--- a/Doc/library/_winreg.rst
+++ b/Doc/library/_winreg.rst
@@ -133,6 +133,16 @@
+-------+--------------------------------------------+
+.. function:: ExpandEnvironmentStrings(unicode)
+
+ Expands environment strings %NAME% in unicode string like const:`REG_EXPAND_SZ`::
+
+ >>> ExpandEnvironmentStrings(u"%windir%")
+ u"C:\\Windows"
+
+ .. versionadded: 2.6
+
+
.. function:: FlushKey(key)
Writes all the attributes of a key to the registry.
@@ -418,3 +428,11 @@
handle is not closed. You would call this function when you need the
underlying Win32 handle to exist beyond the lifetime of the handle object.
+.. method:: PyHKEY.__enter__()
+.. method:: PyHKEY.__exit__(*exc_info)
+
+ The HKEY object implements __enter__ and __exit__ and thus supports the
+ context protocol for the with statement.
+
+ .. versionadded: 2.6
+