Skip to content

Commit 913b21a

Browse files
committed
Update document for OpenKeyEx
1 parent 2475c0b commit 913b21a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Doc/library/winreg.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ This module offers the following functions:
299299
.. audit-event:: winreg.LoadKey key,sub_key,file_name winreg.LoadKey
300300

301301

302-
.. function:: OpenKey(key, sub_key, reserved=0, access=KEY_READ)
303-
OpenKeyEx(key, sub_key, reserved=0, access=KEY_READ)
302+
.. function:: OpenKey(key, sub_key, reserved=0, access=KEY_READ, options=0)
303+
OpenKeyEx(key, sub_key, reserved=0, access=KEY_READ, options=0)
304304

305305
Opens the specified key, returning a :ref:`handle object <handle-object>`.
306306

@@ -309,12 +309,20 @@ This module offers the following functions:
309309

310310
*sub_key* is a string that identifies the sub_key to open.
311311

312-
*reserved* is a reserved integer, and must be zero. The default is zero.
312+
*reserved* is a reserved integer and should be zero.
313+
If it is not zero, it will be treated as the options parameter.
314+
You should use the *options* parameter directly instead,
315+
this parameter is only included for compatibility reasons.
316+
The default value is zero.
313317

314318
*access* is an integer that specifies an access mask that describes the desired
315319
security access for the key. Default is :const:`KEY_READ`. See :ref:`Access
316320
Rights <access-rights>` for other allowed values.
317321

322+
*options* specifies the option to apply when opening the key.
323+
Can be zero or one of the predefined
324+
:ref:`REG_OPTION_* constants <hkey-constants>`.
325+
318326
The result is a new handle to the specified key.
319327

320328
If the function fails, :exc:`OSError` is raised.

PC/winreg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,9 @@ winreg.OpenKey -> HKEY
14111411
sub_key: Py_UNICODE(accept={str, NoneType})
14121412
A string that identifies the sub_key to open.
14131413
reserved: int = 0
1414-
A reserved integer that must be zero. Default is zero.
1414+
A reserved integer that be should zero. If it is not zero,
1415+
it will be used as the options parameter for compatibility reasons.
1416+
Default is zero.
14151417
access: REGSAM(c_default='KEY_READ') = winreg.KEY_READ
14161418
An integer that specifies an access mask that describes the desired
14171419
security access for the key. Default is KEY_READ.

0 commit comments

Comments
 (0)