Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
442ee03d
Commit
442ee03d
authored
Oct 12, 2011
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace mentions of WindowsError
parent
771dea77
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
13 deletions
+56
-13
Doc/library/ctypes.rst
Doc/library/ctypes.rst
+16
-5
Doc/library/winreg.rst
Doc/library/winreg.rst
+40
-8
No files found.
Doc/library/ctypes.rst
View file @
442ee03d
...
...
@@ -39,9 +39,14 @@ loads libraries which export functions using the standard ``cdecl`` calling
convention, while *windll* libraries call functions using the ``stdcall``
calling convention. *oledll* also uses the ``stdcall`` calling convention, and
assumes the functions return a Windows :c:type:`HRESULT` error code. The error
code is used to automatically raise a :class:`
Windows
Error` exception when the
code is used to automatically raise a :class:`
OS
Error` exception when the
function call fails.
.. versionchanged:: 3.3
Windows errors used to raise :exc:`WindowsError`, which is now an alias
of :exc:`OSError`.
Here are some examples for Windows. Note that ``msvcrt`` is the MS standard C
library containing most standard C functions, and uses the cdecl calling
convention::
...
...
@@ -189,7 +194,7 @@ argument values::
>>> windll.kernel32.GetModuleHandleA(32) # doctest: +WINDOWS
Traceback (most recent call last):
File "<stdin>", line 1, in ?
Windows
Error: exception: access violation reading 0x00000020
OS
Error: exception: access violation reading 0x00000020
>>>
There are, however, enough ways to crash Python with :mod:`ctypes`, so you
...
...
@@ -491,7 +496,7 @@ useful to check for error return values and automatically raise an exception::
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 3, in ValidHandle
Windows
Error: [Errno 126] The specified module could not be found.
OS
Error: [Errno 126] The specified module could not be found.
>>>
``WinError`` is a function which will call Windows ``FormatMessage()`` api to
...
...
@@ -1345,7 +1350,10 @@ way is to instantiate one of the following classes:
assumed to return the windows specific :class:`HRESULT` code. :class:`HRESULT`
values contain information specifying whether the function call failed or
succeeded, together with additional error code. If the return value signals a
failure, an :class:`WindowsError` is automatically raised.
failure, an :class:`OSError` is automatically raised.
.. versionchanged:: 3.3
:exc:`WindowsError` used to be raised.
.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False)
...
...
@@ -1966,11 +1974,14 @@ Utility functions
.. function:: WinError(code=None, descr=None)
Windows only: this function is probably the worst-named thing in ctypes. It
creates an instance of
Windows
Error. If *code* is not specified,
creates an instance of
OS
Error. If *code* is not specified,
``GetLastError`` is called to determine the error code. If *descr* is not
specified, :func:`FormatError` is called to get a textual description of the
error.
.. versionchanged:: 3.3
An instance of :exc:`WindowsError` used to be created.
.. function:: wstring_at(address, size=-1)
...
...
Doc/library/winreg.rst
View file @
442ee03d
...
...
@@ -38,7 +38,11 @@ This module offers the following functions:
*key* is the predefined handle to connect to.
The return value is the handle of the opened key. If the function fails, a
:exc:`WindowsError` exception is raised.
:exc:`OSError` exception is raised.
.. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an
alias of :exc:`OSError`.
.. function:: CreateKey(key, sub_key)
...
...
@@ -57,7 +61,11 @@ This module offers the following functions:
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
:exc:`WindowsError` exception is raised.
:exc:`OSError` exception is raised.
.. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an
alias of :exc:`OSError`.
.. function:: CreateKeyEx(key, sub_key, reserved=0, access=KEY_ALL_ACCESS)
...
...
@@ -82,10 +90,14 @@ This module offers the following functions:
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
:exc:`
Windows
Error` exception is raised.
:exc:`
OS
Error` exception is raised.
.. versionadded:: 3.2
.. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an
alias of :exc:`OSError`.
.. function:: DeleteKey(key, sub_key)
...
...
@@ -100,7 +112,11 @@ This module offers the following functions:
*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 fails, a :exc:`WindowsError` exception is raised.
If the method fails, a :exc:`OSError` exception is raised.
.. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an
alias of :exc:`OSError`.
.. function:: DeleteKeyEx(key, sub_key, access=KEY_ALL_ACCESS, reserved=0)
...
...
@@ -129,12 +145,16 @@ This module offers the following functions:
*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 fails, a :exc:`
Windows
Error` exception is raised.
removed. If the method fails, a :exc:`
OS
Error` exception is raised.
On unsupported Windows versions, :exc:`NotImplementedError` is raised.
.. versionadded:: 3.2
.. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an
alias of :exc:`OSError`.
.. function:: DeleteValue(key, value)
...
...
@@ -156,9 +176,13 @@ This module offers the following functions:
*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
typically called repeatedly until a :exc:`
Windows
Error` exception is
typically called repeatedly until a :exc:`
OS
Error` exception is
raised, indicating, no more values are available.
.. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an
alias of :exc:`OSError`.
.. function:: EnumValue(key, index)
...
...
@@ -170,7 +194,7 @@ This module offers the following functions:
*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
typically called repeatedly, until a :exc:`
Windows
Error` exception is
typically called repeatedly, until a :exc:`
OS
Error` exception is
raised, indicating no more values.
The result is a tuple of 3 items:
...
...
@@ -189,6 +213,10 @@ This module offers the following functions:
| | :meth:`SetValueEx`) |
+-------+--------------------------------------------+
.. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an
alias of :exc:`OSError`.
.. function:: ExpandEnvironmentStrings(str)
...
...
@@ -260,10 +288,14 @@ This module offers the following functions:
The result is a new handle to the specified key.
If the function fails, :exc:`
Windows
Error` is raised.
If the function fails, :exc:`
OS
Error` is raised.
.. versionchanged:: 3.2 Allow the use of named arguments.
.. versionchanged:: 3.3
This function used to raise a :exc:`WindowsError`, which is now an
alias of :exc:`OSError`.
.. function:: OpenKeyEx()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment