Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 616f803

Browse files
committed
Issue #16197: Fix several small errors in winreg documentation.
Initial patch by Zachary Ware.
1 parent 08d8434 commit 616f803

2 files changed

Lines changed: 34 additions & 31 deletions

File tree

Doc/library/winreg.rst

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ integer as the registry handle, a :ref:`handle object <handle-object>` is used
1212
to ensure that the handles are closed correctly, even if the programmer neglects
1313
to explicitly close them.
1414

15+
.. _exception-changed:
16+
17+
.. versionchanged:: 3.3
18+
Several functions in this module used to raise a
19+
:exc:`WindowsError`, which is now an alias of :exc:`OSError`.
20+
21+
.. _functions:
22+
23+
Functions
24+
------------------
25+
1526
This module offers the following functions:
1627

1728

@@ -37,12 +48,11 @@ This module offers the following functions:
3748

3849
*key* is the predefined handle to connect to.
3950

40-
The return value is the handle of the opened key. If the function fails, a
51+
The return value is the handle of the opened key. If the function fails, an
4152
:exc:`OSError` exception is raised.
4253

4354
.. versionchanged:: 3.3
44-
This function used to raise a :exc:`WindowsError`, which is now an
45-
alias of :exc:`OSError`.
55+
See :ref:`above <exception-changed>`.
4656

4757

4858
.. function:: CreateKey(key, sub_key)
@@ -60,12 +70,11 @@ This module offers the following functions:
6070

6171
If the key already exists, this function opens the existing key.
6272

63-
The return value is the handle of the opened key. If the function fails, a
73+
The return value is the handle of the opened key. If the function fails, an
6474
:exc:`OSError` exception is raised.
6575

6676
.. versionchanged:: 3.3
67-
This function used to raise a :exc:`WindowsError`, which is now an
68-
alias of :exc:`OSError`.
77+
See :ref:`above <exception-changed>`.
6978

7079

7180
.. function:: CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE)
@@ -89,14 +98,13 @@ This module offers the following functions:
8998

9099
If the key already exists, this function opens the existing key.
91100

92-
The return value is the handle of the opened key. If the function fails, a
101+
The return value is the handle of the opened key. If the function fails, an
93102
:exc:`OSError` exception is raised.
94103

95104
.. versionadded:: 3.2
96105

97106
.. versionchanged:: 3.3
98-
This function used to raise a :exc:`WindowsError`, which is now an
99-
alias of :exc:`OSError`.
107+
See :ref:`above <exception-changed>`.
100108

101109

102110
.. function:: DeleteKey(key, sub_key)
@@ -112,11 +120,10 @@ This module offers the following functions:
112120
*This method can not delete keys with subkeys.*
113121

114122
If the method succeeds, the entire key, including all of its values, is removed.
115-
If the method fails, a :exc:`OSError` exception is raised.
123+
If the method fails, an :exc:`OSError` exception is raised.
116124

117125
.. versionchanged:: 3.3
118-
This function used to raise a :exc:`WindowsError`, which is now an
119-
alias of :exc:`OSError`.
126+
See :ref:`above <exception-changed>`.
120127

121128

122129
.. function:: DeleteKeyEx(key, sub_key, access=KEY_WOW64_64KEY, reserved=0)
@@ -145,15 +152,14 @@ This module offers the following functions:
145152
*This method can not delete keys with subkeys.*
146153

147154
If the method succeeds, the entire key, including all of its values, is
148-
removed. If the method fails, a :exc:`OSError` exception is raised.
155+
removed. If the method fails, an :exc:`OSError` exception is raised.
149156

150157
On unsupported Windows versions, :exc:`NotImplementedError` is raised.
151158

152159
.. versionadded:: 3.2
153160

154161
.. versionchanged:: 3.3
155-
This function used to raise a :exc:`WindowsError`, which is now an
156-
alias of :exc:`OSError`.
162+
See :ref:`above <exception-changed>`.
157163

158164

159165
.. function:: DeleteValue(key, value)
@@ -176,12 +182,11 @@ This module offers the following functions:
176182
*index* is an integer that identifies the index of the key to retrieve.
177183

178184
The function retrieves the name of one subkey each time it is called. It is
179-
typically called repeatedly until a :exc:`OSError` exception is
185+
typically called repeatedly until an :exc:`OSError` exception is
180186
raised, indicating, no more values are available.
181187

182188
.. versionchanged:: 3.3
183-
This function used to raise a :exc:`WindowsError`, which is now an
184-
alias of :exc:`OSError`.
189+
See :ref:`above <exception-changed>`.
185190

186191

187192
.. function:: EnumValue(key, index)
@@ -194,7 +199,7 @@ This module offers the following functions:
194199
*index* is an integer that identifies the index of the value to retrieve.
195200

196201
The function retrieves the name of one subkey each time it is called. It is
197-
typically called repeatedly, until a :exc:`OSError` exception is
202+
typically called repeatedly, until an :exc:`OSError` exception is
198203
raised, indicating no more values.
199204

200205
The result is a tuple of 3 items:
@@ -214,8 +219,7 @@ This module offers the following functions:
214219
+-------+--------------------------------------------+
215220

216221
.. versionchanged:: 3.3
217-
This function used to raise a :exc:`WindowsError`, which is now an
218-
alias of :exc:`OSError`.
222+
See :ref:`above <exception-changed>`.
219223

220224

221225
.. function:: ExpandEnvironmentStrings(str)
@@ -295,8 +299,7 @@ This module offers the following functions:
295299
Allow the use of named arguments.
296300

297301
.. versionchanged:: 3.3
298-
This function used to raise a :exc:`WindowsError`, which is now an
299-
alias of :exc:`OSError`.
302+
See :ref:`above <exception-changed>`.
300303

301304

302305
.. function:: QueryInfoKey(key)

PC/winreg.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ PyDoc_STRVAR(ConnectRegistry_doc,
8989
"key is the predefined handle to connect to.\n"
9090
"\n"
9191
"The return value is the handle of the opened key.\n"
92-
"If the function fails, a WindowsError exception is raised.");
92+
"If the function fails, an OSError exception is raised.");
9393

9494
PyDoc_STRVAR(CreateKey_doc,
9595
"CreateKey(key, sub_key) -> key\n"
@@ -104,7 +104,7 @@ PyDoc_STRVAR(CreateKey_doc,
104104
"If the key already exists, this function opens the existing key.\n"
105105
"\n"
106106
"The return value is the handle of the opened key.\n"
107-
"If the function fails, a WindowsError exception is raised.");
107+
"If the function fails, an OSError exception is raised.");
108108

109109
PyDoc_STRVAR(CreateKeyEx_doc,
110110
"CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE) -> key\n"
@@ -122,7 +122,7 @@ PyDoc_STRVAR(CreateKeyEx_doc,
122122
"If the key already exists, this function opens the existing key\n"
123123
"\n"
124124
"The return value is the handle of the opened key.\n"
125-
"If the function fails, a WindowsError exception is raised.");
125+
"If the function fails, an OSError exception is raised.");
126126

127127
PyDoc_STRVAR(DeleteKey_doc,
128128
"DeleteKey(key, sub_key)\n"
@@ -136,7 +136,7 @@ PyDoc_STRVAR(DeleteKey_doc,
136136
"This method can not delete keys with subkeys.\n"
137137
"\n"
138138
"If the function succeeds, the entire key, including all of its values,\n"
139-
"is removed. If the function fails, a WindowsError exception is raised.");
139+
"is removed. If the function fails, an OSError exception is raised.");
140140

141141
PyDoc_STRVAR(DeleteKeyEx_doc,
142142
"DeleteKeyEx(key, sub_key, access=KEY_WOW64_64KEY, reserved=0)\n"
@@ -153,7 +153,7 @@ PyDoc_STRVAR(DeleteKeyEx_doc,
153153
"This method can not delete keys with subkeys.\n"
154154
"\n"
155155
"If the function succeeds, the entire key, including all of its values,\n"
156-
"is removed. If the function fails, a WindowsError exception is raised.\n"
156+
"is removed. If the function fails, an OSError exception is raised.\n"
157157
"On unsupported Windows versions, NotImplementedError is raised.");
158158

159159
PyDoc_STRVAR(DeleteValue_doc,
@@ -171,7 +171,7 @@ PyDoc_STRVAR(EnumKey_doc,
171171
"index is an integer that identifies the index of the key to retrieve.\n"
172172
"\n"
173173
"The function retrieves the name of one subkey each time it is called.\n"
174-
"It is typically called repeatedly until a WindowsError exception is\n"
174+
"It is typically called repeatedly until an OSError exception is\n"
175175
"raised, indicating no more values are available.");
176176

177177
PyDoc_STRVAR(EnumValue_doc,
@@ -181,7 +181,7 @@ PyDoc_STRVAR(EnumValue_doc,
181181
"index is an integer that identifies the index of the value to retrieve.\n"
182182
"\n"
183183
"The function retrieves the name of one subkey each time it is called.\n"
184-
"It is typically called repeatedly, until a WindowsError exception\n"
184+
"It is typically called repeatedly, until an OSError exception\n"
185185
"is raised, indicating no more values.\n"
186186
"\n"
187187
"The result is a tuple of 3 items:\n"
@@ -240,7 +240,7 @@ PyDoc_STRVAR(OpenKey_doc,
240240
" security access for the key. Default is KEY_READ\n"
241241
"\n"
242242
"The result is a new handle to the specified key\n"
243-
"If the function fails, a WindowsError exception is raised.");
243+
"If the function fails, an OSError exception is raised.");
244244

245245
PyDoc_STRVAR(OpenKeyEx_doc, "See OpenKey()");
246246

0 commit comments

Comments
 (0)