-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-126615: Make COMError
public and add to ctypes
doc.
#126686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
e70aa54
181f512
857fef5
90fb47f
1f9d4ee
b71e310
dafb5b2
49d5e5f
1fa159a
934c36a
9461642
705ffcc
b5a2170
a16f1e2
e2617f3
57d76c5
36f1607
068ea2a
3da9e15
920bccc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1707,12 +1707,6 @@ in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class: | |||||||||||
and raise an exception if the foreign function call failed. | ||||||||||||
|
||||||||||||
|
||||||||||||
.. exception:: ArgumentError | ||||||||||||
|
||||||||||||
This exception is raised when a foreign function call cannot convert one of the | ||||||||||||
passed arguments. | ||||||||||||
|
||||||||||||
|
||||||||||||
.. audit-event:: ctypes.set_exception code foreign-functions | ||||||||||||
|
||||||||||||
On Windows, when a foreign function call raises a system exception (for | ||||||||||||
|
@@ -1799,10 +1793,14 @@ different ways, depending on the type and number of the parameters in the call: | |||||||||||
integer. *name* is name of the COM method. *iid* is an optional pointer to | ||||||||||||
the interface identifier which is used in extended error reporting. | ||||||||||||
|
||||||||||||
If *iid* is not specified, an :exc:`OSError` is raised if the COM method | ||||||||||||
call fails. If *iid* is specified, a :exc:`.COMError` is raised instead. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think (but I'm not 100% sure) that
Suggested change
|
||||||||||||
|
||||||||||||
COM methods use a special calling convention: They require a pointer to | ||||||||||||
the COM interface as first argument, in addition to those parameters that | ||||||||||||
are specified in the :attr:`!argtypes` tuple. | ||||||||||||
|
||||||||||||
|
||||||||||||
The optional *paramflags* parameter creates foreign function wrappers with much | ||||||||||||
junkmd marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
more functionality than the features described above. | ||||||||||||
|
||||||||||||
|
@@ -2741,3 +2739,42 @@ Arrays and pointers | |||||||||||
|
||||||||||||
Returns the object to which to pointer points. Assigning to this | ||||||||||||
attribute changes the pointer to point to the assigned object. | ||||||||||||
|
||||||||||||
|
||||||||||||
.. _ctypes-exceptions: | ||||||||||||
|
||||||||||||
Exceptions | ||||||||||||
^^^^^^^^^^ | ||||||||||||
|
||||||||||||
.. exception:: ArgumentError | ||||||||||||
|
||||||||||||
This exception is raised when a foreign function call cannot convert one of the | ||||||||||||
passed arguments. | ||||||||||||
|
||||||||||||
|
||||||||||||
.. exception:: COMError(hresult, text, details) | ||||||||||||
|
||||||||||||
Windows only: This exception is raised when a COM method call failed. | ||||||||||||
|
||||||||||||
.. attribute:: hresult | ||||||||||||
|
||||||||||||
The integer value representing the error code. | ||||||||||||
|
||||||||||||
.. attribute:: text | ||||||||||||
|
||||||||||||
The error message. | ||||||||||||
|
||||||||||||
.. attribute:: details | ||||||||||||
|
||||||||||||
The 5-tuple ``(descr, source, helpfile, helpcontext, progid)``. | ||||||||||||
|
||||||||||||
*descr* is the textual description. *source* is the language-dependent | ||||||||||||
``ProgID`` for the class or application that raised the error. *helpfile* | ||||||||||||
is the path of the help file. *helpcontext* is the help context | ||||||||||||
identifier. *progid* is the ``ProgID`` of the interface that defined the | ||||||||||||
error. | ||||||||||||
|
||||||||||||
.. versionchanged:: 3.14 | ||||||||||||
|
||||||||||||
This exception is now public. | ||||||||||||
Previously, this was private and only available in ``_ctypes``. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not expose private API in the docs.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You’re right, this information isn’t particularly useful in the documentation. I’ll move it to the NEWS file as a supplement. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The :exc:`~ctypes.COMError` exception is now public. |
Uh oh!
There was an error while loading. Please reload this page.