Skip to content

bpo-35133: Fix mistakes when concatenate string literals on different lines.#10284

Merged
serhiy-storchaka merged 4 commits intopython:masterfrom
serhiy-storchaka:string-literals-concat-multiline
Nov 5, 2018
Merged

bpo-35133: Fix mistakes when concatenate string literals on different lines.#10284
serhiy-storchaka merged 4 commits intopython:masterfrom
serhiy-storchaka:string-literals-concat-multiline

Conversation

@serhiy-storchaka
Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka commented Nov 1, 2018

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.

https://bugs.python.org/issue35133

… 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.
Copy link
Copy Markdown
Member

@ericvsmith ericvsmith left a comment

Choose a reason for hiding this comment

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

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>'),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These tests is the only thing about which I am unsure.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The email team should look and decide. This again, is structured data, not English prose.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not 100% positive, but I think it's okay in this case. I would wait for comment from @bitdancer though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
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.

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.

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"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

        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>'),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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>'),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@bedevere-bot
Copy link
Copy Markdown

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

@serhiy-storchaka
Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link
Copy Markdown

Thanks for making the requested changes!

@bitdancer: please review the changes made to this pull request.

Copy link
Copy Markdown
Contributor

@asottile asottile left a comment

Choose a reason for hiding this comment

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

this is amazing, how did you find all of these? is there a tool or was it through some grep?

@serhiy-storchaka
Copy link
Copy Markdown
Member Author

There are tools for multiline searching, but it was easier to me to write a simple Python script.

Copy link
Copy Markdown
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.

The changes requested by myself and David Murray have be made.

@terryjreedy terryjreedy dismissed bitdancer’s stale review November 5, 2018 14:14

The changes to test_email have be made as requested.

@terryjreedy
Copy link
Copy Markdown
Member

@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.

@serhiy-storchaka serhiy-storchaka merged commit 34fd4c2 into python:master Nov 5, 2018
@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the string-literals-concat-multiline branch November 5, 2018 14:20
@bedevere-bot
Copy link
Copy Markdown

GH-10334 is a backport of this pull request to the 3.7 branch.

@serhiy-storchaka
Copy link
Copy Markdown
Member Author

Thank you all for your reviews!

@miss-islington
Copy link
Copy Markdown
Contributor

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 34fd4c20198dea6ab2fe8dc6d32d744d9bde868d 3.6

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 5, 2018
… 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>
miss-islington added a commit that referenced this pull request Nov 5, 2018
… lines. (GH-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>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Nov 5, 2018
…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>
@bedevere-bot
Copy link
Copy Markdown

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

@serhiy-storchaka serhiy-storchaka removed their assignment Nov 5, 2018
serhiy-storchaka added a commit that referenced this pull request Nov 5, 2018
…ferent lines. (GH-10284) (GH-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)
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Nov 5, 2018
…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)
serhiy-storchaka added a commit that referenced this pull request Nov 5, 2018
…ferent lines. (GH-10284) (GH-10335) (GH-10336)

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants