Merge issue #16197: Fix several small errors in winreg documentation.

Initial patch by Zachary Ware.
This commit is contained in:
Andrew Svetlov 2012-10-31 19:30:00 +02:00
commit 0a4dfc3db9
2 changed files with 34 additions and 31 deletions

View File

@ -12,6 +12,17 @@ integer as the registry handle, a :ref:`handle object <handle-object>` is used
to ensure that the handles are closed correctly, even if the programmer neglects to ensure that the handles are closed correctly, even if the programmer neglects
to explicitly close them. to explicitly close them.
.. _exception-changed:
.. versionchanged:: 3.3
Several functions in this module used to raise a
:exc:`WindowsError`, which is now an alias of :exc:`OSError`.
.. _functions:
Functions
------------------
This module offers the following functions: This module offers the following functions:
@ -37,12 +48,11 @@ This module offers the following functions:
*key* is the predefined handle to connect to. *key* is the predefined handle to connect to.
The return value is the handle of the opened key. If the function fails, a The return value is the handle of the opened key. If the function fails, an
:exc:`OSError` exception is raised. :exc:`OSError` exception is raised.
.. versionchanged:: 3.3 .. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an See :ref:`above <exception-changed>`.
alias of :exc:`OSError`.
.. function:: CreateKey(key, sub_key) .. function:: CreateKey(key, sub_key)
@ -60,12 +70,11 @@ This module offers the following functions:
If the key already exists, this function opens the existing key. If the key already exists, this function opens the existing key.
The return value is the handle of the opened key. If the function fails, a The return value is the handle of the opened key. If the function fails, an
:exc:`OSError` exception is raised. :exc:`OSError` exception is raised.
.. versionchanged:: 3.3 .. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an See :ref:`above <exception-changed>`.
alias of :exc:`OSError`.
.. function:: CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE) .. function:: CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE)
@ -89,14 +98,13 @@ This module offers the following functions:
If the key already exists, this function opens the existing key. If the key already exists, this function opens the existing key.
The return value is the handle of the opened key. If the function fails, a The return value is the handle of the opened key. If the function fails, an
:exc:`OSError` exception is raised. :exc:`OSError` exception is raised.
.. versionadded:: 3.2 .. versionadded:: 3.2
.. versionchanged:: 3.3 .. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an See :ref:`above <exception-changed>`.
alias of :exc:`OSError`.
.. function:: DeleteKey(key, sub_key) .. function:: DeleteKey(key, sub_key)
@ -112,11 +120,10 @@ This module offers the following functions:
*This method can not delete keys with subkeys.* *This method can not delete keys with subkeys.*
If the method succeeds, the entire key, including all of its values, is removed. If the method succeeds, the entire key, including all of its values, is removed.
If the method fails, a :exc:`OSError` exception is raised. If the method fails, an :exc:`OSError` exception is raised.
.. versionchanged:: 3.3 .. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an See :ref:`above <exception-changed>`.
alias of :exc:`OSError`.
.. function:: DeleteKeyEx(key, sub_key, access=KEY_WOW64_64KEY, reserved=0) .. function:: DeleteKeyEx(key, sub_key, access=KEY_WOW64_64KEY, reserved=0)
@ -145,15 +152,14 @@ This module offers the following functions:
*This method can not delete keys with subkeys.* *This method can not delete keys with subkeys.*
If the method succeeds, the entire key, including all of its values, is If the method succeeds, the entire key, including all of its values, is
removed. If the method fails, a :exc:`OSError` exception is raised. removed. If the method fails, an :exc:`OSError` exception is raised.
On unsupported Windows versions, :exc:`NotImplementedError` is raised. On unsupported Windows versions, :exc:`NotImplementedError` is raised.
.. versionadded:: 3.2 .. versionadded:: 3.2
.. versionchanged:: 3.3 .. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an See :ref:`above <exception-changed>`.
alias of :exc:`OSError`.
.. function:: DeleteValue(key, value) .. function:: DeleteValue(key, value)
@ -176,12 +182,11 @@ This module offers the following functions:
*index* is an integer that identifies the index of the key to retrieve. *index* is an integer that identifies the index of the key to retrieve.
The function retrieves the name of one subkey each time it is called. It is The function retrieves the name of one subkey each time it is called. It is
typically called repeatedly until a :exc:`OSError` exception is typically called repeatedly until an :exc:`OSError` exception is
raised, indicating, no more values are available. raised, indicating, no more values are available.
.. versionchanged:: 3.3 .. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an See :ref:`above <exception-changed>`.
alias of :exc:`OSError`.
.. function:: EnumValue(key, index) .. function:: EnumValue(key, index)
@ -194,7 +199,7 @@ This module offers the following functions:
*index* is an integer that identifies the index of the value to retrieve. *index* is an integer that identifies the index of the value to retrieve.
The function retrieves the name of one subkey each time it is called. It is The function retrieves the name of one subkey each time it is called. It is
typically called repeatedly, until a :exc:`OSError` exception is typically called repeatedly, until an :exc:`OSError` exception is
raised, indicating no more values. raised, indicating no more values.
The result is a tuple of 3 items: The result is a tuple of 3 items:
@ -214,8 +219,7 @@ This module offers the following functions:
+-------+--------------------------------------------+ +-------+--------------------------------------------+
.. versionchanged:: 3.3 .. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an See :ref:`above <exception-changed>`.
alias of :exc:`OSError`.
.. function:: ExpandEnvironmentStrings(str) .. function:: ExpandEnvironmentStrings(str)
@ -295,8 +299,7 @@ This module offers the following functions:
Allow the use of named arguments. Allow the use of named arguments.
.. versionchanged:: 3.3 .. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an See :ref:`above <exception-changed>`.
alias of :exc:`OSError`.
.. function:: QueryInfoKey(key) .. function:: QueryInfoKey(key)

View File

@ -89,7 +89,7 @@ PyDoc_STRVAR(ConnectRegistry_doc,
"key is the predefined handle to connect to.\n" "key is the predefined handle to connect to.\n"
"\n" "\n"
"The return value is the handle of the opened key.\n" "The return value is the handle of the opened key.\n"
"If the function fails, a WindowsError exception is raised."); "If the function fails, an OSError exception is raised.");
PyDoc_STRVAR(CreateKey_doc, PyDoc_STRVAR(CreateKey_doc,
"CreateKey(key, sub_key) -> key\n" "CreateKey(key, sub_key) -> key\n"
@ -104,7 +104,7 @@ PyDoc_STRVAR(CreateKey_doc,
"If the key already exists, this function opens the existing key.\n" "If the key already exists, this function opens the existing key.\n"
"\n" "\n"
"The return value is the handle of the opened key.\n" "The return value is the handle of the opened key.\n"
"If the function fails, a WindowsError exception is raised."); "If the function fails, an OSError exception is raised.");
PyDoc_STRVAR(CreateKeyEx_doc, PyDoc_STRVAR(CreateKeyEx_doc,
"CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE) -> key\n" "CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE) -> key\n"
@ -122,7 +122,7 @@ PyDoc_STRVAR(CreateKeyEx_doc,
"If the key already exists, this function opens the existing key\n" "If the key already exists, this function opens the existing key\n"
"\n" "\n"
"The return value is the handle of the opened key.\n" "The return value is the handle of the opened key.\n"
"If the function fails, a WindowsError exception is raised."); "If the function fails, an OSError exception is raised.");
PyDoc_STRVAR(DeleteKey_doc, PyDoc_STRVAR(DeleteKey_doc,
"DeleteKey(key, sub_key)\n" "DeleteKey(key, sub_key)\n"
@ -136,7 +136,7 @@ PyDoc_STRVAR(DeleteKey_doc,
"This method can not delete keys with subkeys.\n" "This method can not delete keys with subkeys.\n"
"\n" "\n"
"If the function succeeds, the entire key, including all of its values,\n" "If the function succeeds, the entire key, including all of its values,\n"
"is removed. If the function fails, a WindowsError exception is raised."); "is removed. If the function fails, an OSError exception is raised.");
PyDoc_STRVAR(DeleteKeyEx_doc, PyDoc_STRVAR(DeleteKeyEx_doc,
"DeleteKeyEx(key, sub_key, access=KEY_WOW64_64KEY, reserved=0)\n" "DeleteKeyEx(key, sub_key, access=KEY_WOW64_64KEY, reserved=0)\n"
@ -153,7 +153,7 @@ PyDoc_STRVAR(DeleteKeyEx_doc,
"This method can not delete keys with subkeys.\n" "This method can not delete keys with subkeys.\n"
"\n" "\n"
"If the function succeeds, the entire key, including all of its values,\n" "If the function succeeds, the entire key, including all of its values,\n"
"is removed. If the function fails, a WindowsError exception is raised.\n" "is removed. If the function fails, an OSError exception is raised.\n"
"On unsupported Windows versions, NotImplementedError is raised."); "On unsupported Windows versions, NotImplementedError is raised.");
PyDoc_STRVAR(DeleteValue_doc, PyDoc_STRVAR(DeleteValue_doc,
@ -171,7 +171,7 @@ PyDoc_STRVAR(EnumKey_doc,
"index is an integer that identifies the index of the key to retrieve.\n" "index is an integer that identifies the index of the key to retrieve.\n"
"\n" "\n"
"The function retrieves the name of one subkey each time it is called.\n" "The function retrieves the name of one subkey each time it is called.\n"
"It is typically called repeatedly until a WindowsError exception is\n" "It is typically called repeatedly until an OSError exception is\n"
"raised, indicating no more values are available."); "raised, indicating no more values are available.");
PyDoc_STRVAR(EnumValue_doc, PyDoc_STRVAR(EnumValue_doc,
@ -181,7 +181,7 @@ PyDoc_STRVAR(EnumValue_doc,
"index is an integer that identifies the index of the value to retrieve.\n" "index is an integer that identifies the index of the value to retrieve.\n"
"\n" "\n"
"The function retrieves the name of one subkey each time it is called.\n" "The function retrieves the name of one subkey each time it is called.\n"
"It is typically called repeatedly, until a WindowsError exception\n" "It is typically called repeatedly, until an OSError exception\n"
"is raised, indicating no more values.\n" "is raised, indicating no more values.\n"
"\n" "\n"
"The result is a tuple of 3 items:\n" "The result is a tuple of 3 items:\n"
@ -240,7 +240,7 @@ PyDoc_STRVAR(OpenKey_doc,
" security access for the key. Default is KEY_READ\n" " security access for the key. Default is KEY_READ\n"
"\n" "\n"
"The result is a new handle to the specified key\n" "The result is a new handle to the specified key\n"
"If the function fails, a WindowsError exception is raised."); "If the function fails, an OSError exception is raised.");
PyDoc_STRVAR(OpenKeyEx_doc, "See OpenKey()"); PyDoc_STRVAR(OpenKeyEx_doc, "See OpenKey()");