-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Reformat paragraphs, add backquotes, and add directives to (parts of) ctypes
doc.
#127210
Reformat paragraphs, add backquotes, and add directives to (parts of) ctypes
doc.
#127210
Conversation
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 consistency changes.
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.
Thanks.
For the record: if the lines are shorter than 80 characters, it's not necessary to do any line-wrapping. It's OK to do it as part of a bigger change, though.
Small changes add noise to Git history, and more importantly, any change means the text needs to be re-translated for non-English versions of the docs. (It will appear in English before it's re-translated, see for example Japanese).
So, I'd like to ask: would you be willing to improve this documentation even more? As a maintainer of a major COM library, you are probably the best person to add things like:
- Stable links to official
DllCanUnloadNow
&DllGetClassObject
documentation - Correct documentation for the arguments and return values (including, for example, how to return a
S_FALSE
from Python -- if we even have public API for that).
Doc/library/ctypes.rst
Outdated
error code is specified, the last error code is used by calling the Windows | ||
api function GetLastError. | ||
Returns a textual description of the error code *code*. If no error code is | ||
specified, the last error code is used by calling the Windows api function |
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.
specified, the last error code is used by calling the Windows api function | |
specified, the last error code is used by calling the Windows API function |
Doc/library/ctypes.rst
Outdated
This function is probably the worst-named thing in ``ctypes``. It creates an | ||
instance of :exc:`OSError`. If *code* is not specified, :func:`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. |
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.
Since Python 3.3 merged WindowsError
into OSError
, this is no longer the worst-named thing in ctypes
(if it ever was) :)
And the negativity isn't helping anyone.
This function is probably the worst-named thing in ``ctypes``. It creates an | |
instance of :exc:`OSError`. If *code* is not specified, :func:`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. | |
Creates an | |
instance of :exc:`OSError`. If *code* is not specified, :func:`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. |
Sure.
I’m currently looking for appropriate examples. I’ll mention you once the sentence is finalized. Please give me some time. |
4e85cfc
to
1f0450b
Compare
1f0450b
to
0a33f3e
Compare
cpython/Lib/ctypes/__init__.py Lines 574 to 579 in 2b0e2b2
Similarly, cpython/Lib/ctypes/__init__.py Lines 566 to 572 in 2b0e2b2
It seems that for many years, there has been this state where the standard library In fact, I have never directly called these functions myself. I am currently investigating how they behave in Python. Depending on the results of my investigation, I may open an issue regarding these two functions and possibly revert the documentation changes related to them in this PR. |
Oh. I should have checked the implementation! IMO, we should deprecate those, tell people to import them from |
I have no objections to deprecating these APIs in On the other hand, I haven’t been able to find any use cases where these functions are called directly. I think it would be helpful if we could create a flow where developers who see the warning message triggered by calling these functions reach out to the maintainers of |
For now, I have reverted the documentation for |
It might be worth considering gathering opinions not only through this PR and issue but also on Discourse. |
Thank you for merging this. I am compiling the current state of Please wait a little. |
In gh-127099, I reverted the reformatting paragraphs, leaving the lines in an unorganized state.
I noticed that in the recent documentation, certain parts that should be enclosed in backquotes or use directives were not properly formatted in the
ctypes
documentation.I found similar parts in other sections, but for now, I focused on improving only the sections related to gh-127099.
📚 Documentation preview 📚: https://cpython-previews--127210.org.readthedocs.build/