mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Added __enter__ and __exit__ functions to HKEY object
Added ExpandEnvironmentStrings to the _winreg module.
This commit is contained in:
parent
41f278ffa5
commit
b39a756afd
4 changed files with 104 additions and 20 deletions
|
|
@ -133,6 +133,16 @@ This module offers the following functions:
|
|||
+-------+--------------------------------------------+
|
||||
|
||||
|
||||
.. 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, and also disconnect the Windows handle from the handle object.
|
|||
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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue