-
-
Notifications
You must be signed in to change notification settings - Fork 33.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 5 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 | ||||
---|---|---|---|---|---|---|
|
@@ -1799,10 +1799,31 @@ 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, a :exc:`WindowsError` is raised if the COM method | ||||||
call fails. If *iid* is specified, a :exc:`.COMError` is raised instead. | ||||||
junkmd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
call fails. If *iid* is specified, a :exc:`.COMError` is raised instead. | |
call fails. If *iid* is specified, a :exc:`~ctypes.COMError` is raised instead. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be placed here or somewhere else? because it cuts the flow of the reading where paramflags is documented afterwards. Maybe we can put it before the functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also unsure whether this was the right place to put it.
On the other hand, placing it above prototype
or above FOOFUNCTYPE
might seem abrupt.
Might it be appropriate to create the Exceptions
section, including ArgumentError
?
However, in this scope, I think making such a change that involves the "Foreign functions" section is excessive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well.. honestly I think it makes sense to put it in an exception section. I think it could be fine for this small docs change (I mean, it's for our own convenience). We can ask @hugovk as a docs expert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we often have an exceptions section further down, see for example:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the community agrees, creating an "Exceptions" section is no problem at all.
For now, I think I'll try placing it at the end of the document, after the "Arrays and pointers" section.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use .. availability:: Windows
(but put the directive after the class doc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the pattern in ctypes.rst
because it frequently used sentences like Windows only: ...
.
Since this markup wasn't mentioned in the documentation guide, I overlooked it.
Is this a more modern approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's widely used in the https://docs.python.org/3/library/socket.html module actually. But if it's not the pattern of ctypes
maybe it's better to be consistent. We can make a follow-up PR to transform them into directives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the Availability
directive and reverted to the original "Windows only: ...".
Once this PR is merged, I would like to work for replacing "Foo only: ..." with the .. availability:: Foo
directive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referring to the socket.ioctl
documentation, it seems that using :platform: Windows
might be more appropriate than .. availability:: Windows
. What do you think?
Alternatively, could it be that :platform:
is intended to be used exclusively in module sections, as described in the documentation guide's "Module-specific markup"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. availability::
is generally the correct one to use. FWIW, we have some tooling to ensure it's in a correct format.
It's OK to not use it in this PR, to be consistent with the rest of the documentation. But, if you're looking for more to do in the ctypes docs, adding availability
would make a great follow-up PR :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WindowsError
is now an alias ofOSError
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
Thank you.