Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 3 commits into from
Oct 7, 2024

Conversation

ffelixg
Copy link
Contributor

@ffelixg ffelixg commented Sep 23, 2024

When no module name is specified, a warning is raised upon type creation.
@ghost
Copy link

ghost commented Sep 23, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

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
Copy link
Member

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.

@@ -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
Copy link
Member

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."

Copy link
Contributor Author

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.

@vstinner
Copy link
Member

@encukou: Would you mind to review this change? Does it explain correctly that the name must contain a module name?

@JelleZijlstra
Copy link
Member

It might be worth being more explicit and saying the name must include the module name, and given an example like os.terminal_size. (Aside: several structseqs in posixmodule.c do not include the module name. Should they be fixed?)

@ffelixg
Copy link
Contributor Author

ffelixg commented Oct 7, 2024

It might be worth being more explicit and saying the name must include the module name, and given an example like os.terminal_size. (Aside: several structseqs in posixmodule.c do not include the module name. Should they be fixed?)

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.

Copy link
Member

@vstinner vstinner left a 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?

@vstinner vstinner merged commit 3287c83 into python:main Oct 7, 2024
25 checks passed
@vstinner
Copy link
Member

vstinner commented Oct 7, 2024

Merged, thanks @ffelixg for the doc and @JelleZijlstra for the reviews ;-)

@vstinner vstinner added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Oct 7, 2024
@miss-islington-app
Copy link

Thanks @ffelixg for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @ffelixg for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 7, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 7, 2024
@bedevere-app
Copy link

bedevere-app bot commented Oct 7, 2024

GH-125056 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Oct 7, 2024
@bedevere-app
Copy link

bedevere-app bot commented Oct 7, 2024

GH-125057 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 7, 2024
vstinner pushed a commit that referenced this pull request Oct 7, 2024
…124335) (#125056)

gh-124182: Explain naming rules for struct sequence types (GH-124335)
(cherry picked from commit 3287c83)

Co-authored-by: ffelixg <[email protected]>
vstinner pushed a commit that referenced this pull request Oct 7, 2024
…124335) (#125057)

gh-124182: Explain naming rules for struct sequence types (GH-124335)
(cherry picked from commit 3287c83)

Co-authored-by: ffelixg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants