-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-124182: Explain naming rules for struct sequence types #124335
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
Conversation
When no module name is specified, a warning is raised upon type creation.
Doc/c-api/tuple.rst
Outdated
Pointer to a NUL-terminated string containing the fully qualified name of the | ||
type. For types that are accessible as module globals, the string should be | ||
the full module name, followed by a dot, followed by the type name. If the | ||
module is a submodule of a package, the full package name is part of the full |
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 module is a submodule (...)" IMO that's too much, you can remove it.
Doc/c-api/tuple.rst
Outdated
@@ -167,7 +167,13 @@ type. | |||
|
|||
.. c:member:: const char *name | |||
|
|||
Name of the struct sequence type. | |||
Pointer to a NUL-terminated string containing the fully qualified name of the | |||
type. For types that are accessible as module globals, the string should be |
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 suggest to replace the whole paragraph with just:
"Fully qualified name of the type; null-terminated UTF-8 encoded."
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.
Fine with me. I think it would have been enough to put me on the right track when I ran into the issue.
@encukou: Would you mind to review this change? Does it explain correctly that the name must contain a module name? |
It might be worth being more explicit and saying the name must include the module name, and given an example like |
Co-authored-by: Victor Stinner <[email protected]>
Looks to me like all of the incorrect names in posixmodule.c get overwritten to include the module name before they are accessed. Not sure why they didn't get the right name from the beginning, seems to work just as well. |
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.
LGTM.
@JelleZijlstra: Do you want to double check the change?
Merged, thanks @ffelixg for the doc and @JelleZijlstra for the reviews ;-) |
…onGH-124335) (cherry picked from commit 3287c83) Co-authored-by: ffelixg <[email protected]>
…onGH-124335) (cherry picked from commit 3287c83) Co-authored-by: ffelixg <[email protected]>
GH-125056 is a backport of this pull request to the 3.12 branch. |
GH-125057 is a backport of this pull request to the 3.13 branch. |
📚 Documentation preview 📚: https://cpython-previews--124335.org.readthedocs.build/