Skip to content

bpo-30246: fix several error messages which only mention bytes in struct #1421

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
Sep 14, 2017

Conversation

zhangyangyu
Copy link
Member

No description provided.

@mention-bot
Copy link

@zhangyangyu, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Yhg1s, @serhiy-storchaka and @mdickinson to be potential reviewers.

Copy link
Contributor

@louisom louisom left a comment

Choose a reason for hiding this comment

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

small point, other LGTM

"iterative unpacking requires a bytes length "
"multiple of %zd",
"iterative unpacking requires a bytes-like object of "
"length multiple of %zd",
Copy link
Contributor

@louisom louisom May 3, 2017

Choose a reason for hiding this comment

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

maybe bytes-like object of its length is multiple of?

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Don't haste with merging this patch. I'll try to find the past discussion about the similar issue.

@@ -1734,8 +1735,8 @@ Struct_iter_unpack(PyStructObject *self, PyObject *buffer)
}
if (iter->buf.len % self->s_size != 0) {
PyErr_Format(StructError,
"iterative unpacking requires a bytes length "
"multiple of %zd",
"iterative unpacking requires a buffer of "
Copy link
Member

Choose a reason for hiding this comment

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

"length" is lost.

Copy link
Member Author

Choose a reason for hiding this comment

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

I delibrately discard it. Now the error messages in struct all get a "requires a buffer of %d bytes" format.

Copy link
Member

Choose a reason for hiding this comment

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

“. . . a buffer of a multiple of . . .” would read better to me. Or simpler: “requires a multiple of . . . bytes”.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@zhangyangyu
Copy link
Member Author

What's the status of this PR @serhiy-storchaka ?

Copy link
Contributor

@AraHaan AraHaan 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 wording is alright.

@zhangyangyu
Copy link
Member Author

Is it okay for me to merge this now @vadmium @serhiy-storchaka ?

@vadmium
Copy link
Member

vadmium commented Sep 13, 2017

The changes look okay to me.

@zhangyangyu zhangyangyu merged commit c3e97d9 into python:master Sep 14, 2017
@miss-islington
Copy link
Contributor

Thanks @zhangyangyu for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

@zhangyangyu zhangyangyu deleted the struct-errmsg branch September 14, 2017 02:33
@miss-islington
Copy link
Contributor

Sorry, @zhangyangyu, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.

@bedevere-bot
Copy link

GH-3561 is a backport of this pull request to the 3.6 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants