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-143672: convert the struct module to AC#143673

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

Closed
skirpichev wants to merge9 commits intopython:mainfromskirpichev:struct-AC/143672

Conversation

@skirpichev
Copy link
Member

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


See help(struct) for more on format strings.
Return a new Struct object which writes and reads binary data according
to the format string. See help(struct) for more on format strings.
Copy link
Member

Choose a reason for hiding this comment

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

what is the reason for newline -> double space change? I was not aware that this is required.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

In some docstrings "See help(struct) for more on format strings." was separated to a new paragraph. In some - no. Looks as a waste of space, especially in help(struct) output.

/
*args: array

Pack args to the writtable buffer according to the format self.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Packargstothewrittablebufferaccordingtotheformatself.
Packargstothewrittablebufferaccordingtothestruct'sformatstring.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Too long. Beware@permit_long_summary.

strings.");
*args: array

Return a bytes object with args, packed according the format self.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Returnabytesobjectwithargs,packedaccordingtheformatself.
Returnabytesobjectwithargs,packedaccordingthestruct'sformatstring.

@skirpichev
Copy link
MemberAuthor

BTW, I'm not attached to docstrings.

IMO, they aren't good and I tried to improve that. But I can just revert that stuff and keep old doctsrings almost literally (summary line is required, though).

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.

Sorry, I have not noticed this PR and created an alternative PR#143857.

There are some differences between two PRs, and I had reasons for all changes. We can now gradually convert your PR into my PR by applying one change at a time or just take my PR.

See the difference between the PRs:https://github.com/skirpichev/cpython/pull/14/changes .

Struct.pack_into as s_pack_into

buffer: Py_buffer
offset: Py_ssize_t

Choose a reason for hiding this comment

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

There is a subtle behavior difference here (IndexError vs OverflowError). I leave this for other issue.

buffer: Py_buffer
offset: Py_ssize_t
/
*args: array

Choose a reason for hiding this comment

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

I prever to use more specific namevalues.

/*[clinic input]
Struct.pack_into as s_pack_into

buffer: Py_buffer

Choose a reason for hiding this comment

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

The buffer must be writeable.

offset. Note that the offset is a required argument. See\n\
help(struct) for more on format strings.");
/*[clinic input]
Struct.pack_into as s_pack_into

Choose a reason for hiding this comment

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

No need to rename it.

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

Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@sobolevnsobolevnsobolevn left review comments

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@skirpichev@serhiy-storchaka@sobolevn

[8]ページ先頭

©2009-2026 Movatter.jp