Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Clarify argument/result ownership/validity for PyModule_* functions#141159

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
encukou wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromencukou:capi-ownership-docs

Conversation

@encukou
Copy link
Member

@encukouencukou commentedNov 6, 2025
edited by github-actionsbot
Loading

When working onPEP-793 docs, I found some backportable clarifications. (Sure, some clarify that the functions are somewhat dangerous with free-threading...)

Also: Turn a mention oftypes.ModuleType into a link.


📚 Documentation preview 📚:https://cpython-previews--141159.org.readthedocs.build/

``'utf-8'``.
The returned buffer is only valid until the module is renamed or destroyed.
Note that Python code may rename a module by setting its ``__name__``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This can be a link:

Suggested change
Note that Python code may rename a module by setting its``__name__``
Note that Python code may rename a module by setting its:py:attr:`~module.__name__`

Similar to:c:func:`PyModule_GetFilenameObject` but return the filename
encoded to 'utf-8'.
The returned buffer is only valid until the module's ``__file__`` attribute
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Same here; we might as well link where we can.

Suggested change
The returned buffer is only valid until the module's``__file__`` attribute
The returned buffer is only valid until the module's:py:attr:`~module.__file__` attribute

Comment on lines +684 to +685
The *functions* array must be statically allocated (or otherwise guaranteed
to outlive the module object).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think it's a little bit confusing to say somethingmust be true, and then immediately contradict it. How about we say something like this?

The *functions* array must outlive the module object. A common way to dothis is to statically allocate it.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ZeroIntensityZeroIntensityZeroIntensity left review comments

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

Assignees

No one assigned

Labels

awaiting core reviewdocsDocumentation in the Doc dirneeds backport to 3.13bugs and security fixesneeds backport to 3.14bugs and security fixesskip issueskip news

Projects

Status: Todo

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@encukou@ZeroIntensity

[8]ページ先頭

©2009-2025 Movatter.jp