Skip to content

Commit 5badb7a

Browse files
committed
Update document
1 parent 1b473ad commit 5badb7a

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

Doc/library/winreg.rst

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ This module offers the following functions:
306306
.. audit-event:: winreg.LoadKey key,sub_key,file_name winreg.LoadKey
307307

308308

309-
.. function:: OpenKey(key, sub_key, reserved=0, access=KEY_READ, options=0)
310-
OpenKeyEx(key, sub_key, reserved=0, access=KEY_READ, options=0)
309+
.. function:: OpenKey(key, sub_key, reserved=0, access=KEY_READ)
311310

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

@@ -316,11 +315,34 @@ This module offers the following functions:
316315

317316
*sub_key* is a string that identifies the sub_key to open.
318317

319-
*reserved* is a reserved integer and should be zero.
320-
If it is not zero, it will be treated as the options parameter.
321-
You should use the *options* parameter directly instead,
322-
this parameter is only included for compatibility reasons.
323-
The default value is zero.
318+
*reserved* is a reserved integer, and must be zero. The default is zero.
319+
320+
*access* is an integer that specifies an access mask that describes the desired
321+
security access for the key. Default is :const:`KEY_READ`. See :ref:`Access
322+
Rights <access-rights>` for other allowed values.
323+
324+
The result is a new handle to the specified key.
325+
326+
If the function fails, :exc:`OSError` is raised.
327+
328+
.. audit-event:: winreg.OpenKey key,sub_key,access winreg.OpenKey
329+
330+
.. audit-event:: winreg.OpenKey/result key winreg.OpenKey
331+
332+
.. versionchanged:: 3.2
333+
Allow the use of named arguments.
334+
335+
.. versionchanged:: 3.3
336+
See :ref:`above <exception-changed>`.
337+
338+
.. function:: OpenKeyEx(key, sub_key, options=0, access=KEY_READ, reserved=0)
339+
340+
Opens the specified key, returning a :ref:`handle object <handle-object>`.
341+
342+
*key* is an already open key, or one of the predefined
343+
:ref:`HKEY_* constants <hkey-constants>`.
344+
345+
*sub_key* is a string that identifies the sub_key to open.
324346

325347
*access* is an integer that specifies an access mask that describes the desired
326348
security access for the key. Default is :const:`KEY_READ`. See :ref:`Access
@@ -330,6 +352,12 @@ This module offers the following functions:
330352
Can be zero or one of the predefined
331353
:ref:`REG_OPTION_* constants <hkey-constants>`.
332354

355+
*reserved* is a reserved integer and should be zero.
356+
If it is not zero, it will be treated as the options parameter.
357+
You should use the *options* parameter directly instead,
358+
this parameter is only included for compatibility reasons.
359+
The default value is zero.
360+
333361
The result is a new handle to the specified key.
334362

335363
If the function fails, :exc:`OSError` is raised.
@@ -343,6 +371,13 @@ This module offers the following functions:
343371

344372
.. versionchanged:: 3.3
345373
See :ref:`above <exception-changed>`.
374+
375+
.. versionchanged:: 3.14
376+
Added *options* parameter.
377+
378+
.. deprecated-removed:: 3.14 3.16
379+
*reserved* is deprecated and will be removed in the future.
380+
Please use *options* instead.
346381

347382

348383
.. function:: QueryInfoKey(key)

0 commit comments

Comments
 (0)