Skip to content
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

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

Conversation

serhiy-storchaka
Copy link
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
Member

@ericvsmith ericvsmith left a 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.

Lib/idlelib/idle_test/htest.py Outdated Show resolved Hide resolved
@@ -2154,11 +2154,11 @@ def test_get_group_one_invalid(self):

def test_get_group_missing_final_semicol(self):
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
Member

@ericvsmith ericvsmith Nov 1, 2018

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
Member Author

@serhiy-storchaka serhiy-storchaka Nov 1, 2018

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
Member

@terryjreedy terryjreedy Nov 1, 2018

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
Member

@warsaw warsaw Nov 1, 2018

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
Member

@bitdancer bitdancer Nov 1, 2018

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.

Lib/test/test_http_cookiejar.py Show resolved Hide resolved
Lib/unittest/mock.py Show resolved Hide resolved
Copy link
Member

@terryjreedy terryjreedy left a 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.

@@ -2209,7 +2209,7 @@ def get_section(value):
digits += value[0]
value = value[1:]
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
Member

@terryjreedy terryjreedy Nov 1, 2018

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"))

Lib/idlelib/idle_test/htest.py Show resolved Hide resolved
Lib/idlelib/idle_test/htest.py Show resolved Hide resolved
Lib/test/test_email/test__header_value_parser.py Outdated Show resolved Hide resolved
@@ -2154,11 +2154,11 @@ def test_get_group_one_invalid(self):

def test_get_group_missing_final_semicol(self):
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
Member

@terryjreedy terryjreedy Nov 1, 2018

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.

Lib/test/test_http_cookiejar.py Show resolved Hide resolved
bitdancer
bitdancer previously requested changes Nov 1, 2018
Lib/test/test_email/test__header_value_parser.py Outdated Show resolved Hide resolved
@@ -2154,11 +2154,11 @@ def test_get_group_one_invalid(self):

def test_get_group_missing_final_semicol(self):
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
Member

@bitdancer bitdancer Nov 1, 2018

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

bedevere-bot commented Nov 1, 2018

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

serhiy-storchaka commented Nov 1, 2018

I have made the requested changes; please review again.

@bedevere-bot
Copy link

bedevere-bot commented Nov 1, 2018

Thanks for making the requested changes!

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

Copy link
Contributor

@asottile asottile left a comment

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

@serhiy-storchaka
Copy link
Member Author

serhiy-storchaka commented Nov 5, 2018

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

Copy link
Member

@terryjreedy terryjreedy left a comment

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

@terryjreedy terryjreedy dismissed bitdancer’s stale review Nov 5, 2018

The changes to test_email have be made as requested.

@terryjreedy
Copy link
Member

terryjreedy commented Nov 5, 2018

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

miss-islington commented Nov 5, 2018

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 Nov 5, 2018
@bedevere-bot
Copy link

bedevere-bot commented Nov 5, 2018

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

@serhiy-storchaka
Copy link
Member Author

serhiy-storchaka commented Nov 5, 2018

Thank you all for your reviews!

@miss-islington
Copy link
Contributor

miss-islington commented Nov 5, 2018

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

bedevere-bot commented Nov 5, 2018

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.

None yet

10 participants