bpo-35133: Fix mistakes when concatenate string literals on different lines.#10284
Conversation
… lines. Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings.
ericvsmith
left a comment
There was a problem hiding this comment.
I have a few comments, the others look good. Although this whole change just points out a pitfall of having max. line length constraints: errors like the ones you're fixing are pretty common, and hard to spot.
| group = self._test_get_x(parser.get_group, | ||
| ('Monty Python:"Fred A. Bear" <dinsdale@example.com>,' | ||
| ('Monty Python:"Fred A. Bear" <dinsdale@example.com>, ' | ||
| 'eric@where.test,John <jdoe@test>'), |
There was a problem hiding this comment.
What about the missing space before John on this and subsequent lines? I realize it's not the issue you're solving, but since you're adding spaces after commas, do you need one here, too? Or maybe the point of this test is to not have spaces after commas? I haven't looked at it closely yet.
There was a problem hiding this comment.
These tests is the only thing about which I am unsure.
There was a problem hiding this comment.
The email team should look and decide. This again, is structured data, not English prose.
There was a problem hiding this comment.
I'm not 100% positive, but I think it's okay in this case. I would wait for comment from @bitdancer though.
There was a problem hiding this comment.
I think you should leave all the email tests alone. Having a mixture of spaces after commas and no spaces after commas is good thing in these tests, and although I don't remember for sure, most likely intentional.
terryjreedy
left a comment
There was a problem hiding this comment.
The fixes for list errors and English misspellings (other than the assert failure message) look correct.
I think an email person (@bitdancer ) should look at the email test data formatting -- or omit the changes.
Lib/email/_header_value_parser.py
Outdated
| if digits[0] == '0' and digits != '0': | ||
| section.defects.append(errors.InvalidHeaderError("section number" | ||
| section.defects.append(errors.InvalidHeaderError("section number " | ||
| "has an invalid leading 0")) |
There was a problem hiding this comment.
section.defects.append(errors.InvalidHeaderError("section number "
"has an invalid leading 0"))
could evade the issue and be a bit more readable with
section.defects.append(errors.InvalidHeaderError(
"section number has an invalid leading 0"))
| group = self._test_get_x(parser.get_group, | ||
| ('Monty Python:"Fred A. Bear" <dinsdale@example.com>,' | ||
| ('Monty Python:"Fred A. Bear" <dinsdale@example.com>, ' | ||
| 'eric@where.test,John <jdoe@test>'), |
There was a problem hiding this comment.
The email team should look and decide. This again, is structured data, not English prose.
| group = self._test_get_x(parser.get_group, | ||
| ('Monty Python:"Fred A. Bear" <dinsdale@example.com>,' | ||
| ('Monty Python:"Fred A. Bear" <dinsdale@example.com>, ' | ||
| 'eric@where.test,John <jdoe@test>'), |
There was a problem hiding this comment.
I think you should leave all the email tests alone. Having a mixture of spaces after commas and no spaces after commas is good thing in these tests, and although I don't remember for sure, most likely intentional.
|
When you're done making the requested changes, leave the comment: |
|
I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @bitdancer: please review the changes made to this pull request. |
asottile
left a comment
There was a problem hiding this comment.
this is amazing, how did you find all of these? is there a tool or was it through some grep?
|
There are tools for multiline searching, but it was easier to me to write a simple Python script. |
terryjreedy
left a comment
There was a problem hiding this comment.
The changes requested by myself and David Murray have be made.
The changes to test_email have be made as requested.
|
@bitdancer Since you have not re-reviewed since 44c6760 removed the changes to test_email, 4 days ago, I guessed that you must be busy. So your request was easy to confirm, I took the initiative of doing so in your behalf and dismissing your negative review, and giving Serhiy an OK to merge. If this annoys you, let me know that I should not repeat. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
|
GH-10334 is a backport of this pull request to the 3.7 branch. |
|
Thank you all for your reviews! |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
… lines. (pythonGH-10284) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings. (cherry picked from commit 34fd4c2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…ferent lines. (pythonGH-10284) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings.. (cherry picked from commit 34fd4c2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-10335 is a backport of this pull request to the 3.6 branch. |
…ferent lines. (pythonGH-10284) (pythonGH-10335) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings.. (cherry picked from commit 34fd4c2). (cherry picked from commit 7054e5c)
Two kind of mistakes:
Missed space. After concatenating there is no space between words.
Missed comma. Causes unintentional concatenating in a list of strings.
https://bugs.python.org/issue35133