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-143715: deprecate incomplete initialization of struct.Struct()#143659

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
skirpichev wants to merge13 commits intopython:main
base:main
Choose a base branch
Loading
fromskirpichev:deprecate-struct-init-2/78724

Conversation

@skirpichev
Copy link
Member

@skirpichevskirpichev commentedJan 10, 2026
edited by bedevere-appbot
Loading

  • Struct.__new__() will require a mandatory argument (format)
  • Calls of__init__() method on initialized Struct are deprecated

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

* ``Struct.__new__()`` will require a mandatory argument (format)* Calls of ``__init__()`` method on initialized Struct are deprecated
@skirpichev
Copy link
MemberAuthor

The evil plan is to remove customStruct.__init__() method and move all initialization logic to theStruct.__new__(). Something, that was done by#94532 before.

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

I think this needs a separate issue for discussion. Please open a new issue, and refer#78724 and#112358 (maybe even with citations).

We need to discuss what should be the end goal after the end of the deprecation period, and how deprecations canl help to transit the user code.

@skirpichevskirpichev marked this pull request as draftJanuary 12, 2026 00:23
@skirpichevskirpichev changed the titlegh-78724: deprecate incomplete initialization of struct.Struct()gh-143715: deprecate incomplete initialization of struct.Struct()Jan 12, 2026
@skirpichevskirpichev marked this pull request as ready for reviewJanuary 12, 2026 06:09
This make format argument in the __init__() - optional.  If it'smissing, the object must be already initialized in __new__().
@skirpichev
Copy link
MemberAuthor

CC@meadori per experts index.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

What do you think@serhiy-storchaka?

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

Reviewers

@vstinnervstinnervstinner approved these changes

@AA-TurnerAA-TurnerAwaiting requested review from AA-TurnerAA-Turner is a code owner

@serhiy-storchakaserhiy-storchakaAwaiting requested review from serhiy-storchaka

@meadorimeadoriAwaiting requested review from meadori

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@skirpichev@vstinner@serhiy-storchaka

[8]ページ先頭

©2009-2026 Movatter.jp