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

GH-134160: Prefer multi-phase initialisation in docs#134764

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
AA-Turner wants to merge2 commits intopython:main
base:main
Choose a base branch
Loading
fromAA-Turner:docs/prefer-multi-phase

Conversation

AA-Turner
Copy link
Member

@AA-TurnerAA-Turner commentedMay 27, 2025
edited by github-actionsbot
Loading

Comment on lines -287 to +273
An alternate way to specify extensions is to request "multi-phase initialization".
The preferred method to specify extensions is to request "multi-phase initialization".
Extension modules created this way behave more like Python modules: the
initialization is split between the *creation phase*, when the module object
is created, and the *execution phase*, when it is populated.
The distinction is similar to the :py:meth:`!__new__` and :py:meth:`!__init__` methods
of classes.

Unlike modules created using single-phase initialization, these modules are not
singletons: if the *sys.modules* entry is removed and the module is re-imported,
a new module object is created, and the old module is subject to normal garbage
collection -- as with Python modules.
Unlike modules created usingthe legacysingle-phase initialization mechanism,
these modules are notsingletons: if the *sys.modules* entry is removed and
the module is re-imported,a new module object is created, and the old module
is subject to normal garbagecollection -- as with Python modules.
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 this shouldn't be a comparison. If we're calling single-phase “legacy” (which finallyseems to be the cunsensus), then this section should describe what modulesare, and the single-phase section should describe the eldritch weirdness of that method.
Should I try to reword it that way? (I'd like to avoid merge conflicts.)

AA-Turner and gpshead reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

There is existing mention of single-phase as 'legacy', though admittedly in a niche location:https://docs.python.org/3/c-api/init.html#c.PyInterpreterConfig.check_multi_interp_extensions

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Should I try to reword it that way? (I'd like to avoid merge conflicts.)

@encukou feel free to push to this branch.

gpshead reacted with heart emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@encukouencukouencukou 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 newstopic-C-API
Projects
Status: Todo
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@AA-Turner@encukou@ZeroIntensity

[8]ページ先頭

©2009-2025 Movatter.jp