Skip to content

gh-117557: Improve error messages when a string, bytes or bytearray of length 1 are expected #117631

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

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Apr 8, 2024

@bedevere-app bedevere-app bot added docs Documentation in the Doc dir awaiting core review labels Apr 8, 2024
@serhiy-storchaka serhiy-storchaka force-pushed the parse-single-char-errors branch from 15ff9a3 to 308f7a2 Compare April 8, 2024 10:53
@serhiy-storchaka serhiy-storchaka requested a review from a team as a code owner April 8, 2024 10:53
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

Nice; thanks, Serhiy!

I left some comments.

@erlend-aasland erlend-aasland changed the title gh-117558: Improve error messages when a string, bytes or bytearray of length 1 are expected gh-117557: Improve error messages when a string, bytes or bytearray of length 1 are expected Apr 8, 2024
@erlend-aasland
Copy link
Contributor

Right, %T, not %N. It's too new 😆 re. 054f12f

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

🚀

@serhiy-storchaka
Copy link
Member Author

I am not sure about articles. It is a puzzle to me whether they should be used, and whether not.

Copy link
Contributor

@erlend-aasland erlend-aasland 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 these suggestions are correct, but I'd like them to be verified by a native speaker.

Co-authored-by: Erlend E. Aasland <[email protected]>
@serhiy-storchaka
Copy link
Member Author

@terryjreedy, could you please take a look?

Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

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

I checked the tests non-clinic python code carefully and tried the check the logic of the rest. It seems that there are more error cases that error tests, so I wonder if all were covered in a test.

Over all I really like the patch.

@bedevere-app
Copy link

bedevere-app bot commented Apr 8, 2024

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@serhiy-storchaka
Copy link
Member Author

I have made the requested changes; please review again.

Although I am not sure that I have made them all. There is a variety in wording, and some examples look contradictory.

"a unicode character", "str of length 1", "string of length 1" -- refers to str of length 1.
"one character bytes", "a single byte", "bytes of length 1", "a byte string of length 1", "bytes object of length 1" -- refers to bytes (or bytearray) of length 1.

@bedevere-app
Copy link

bedevere-app bot commented Apr 15, 2024

Thanks for making the requested changes!

@erlend-aasland, @terryjreedy: please review the changes made to this pull request.

@serhiy-storchaka
Copy link
Member Author

@terryjreedy, could you please take another look?

@serhiy-storchaka serhiy-storchaka merged commit b313cc6 into python:main May 28, 2024
45 of 46 checks passed
@serhiy-storchaka serhiy-storchaka deleted the parse-single-char-errors branch May 28, 2024 09:01
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants