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-43125: Fix: return expected type (str), not original value (bytes) in email/base64mime.py::body_encode #24476

Merged
merged 5 commits into from Mar 30, 2021

Conversation

gst
Copy link
Contributor

@gst gst commented Feb 7, 2021

All in title.

the utility function Lib/email/base64mime.py::body_encode :

def body_encode(s, maxlinelen=76, eol=NL):

returns its given input if this one evaluates to False. This is bad. given the expected input is bytes but the expected output is str. ( return EMPTYSTRING.join(encvec) ).

The fix looks obvious: return an empty string instead of the original object (whatever type it might be).

https://bugs.python.org/issue43125

@gst gst changed the title bpo-43125: Fix: return expected type (str), not original value (bytes) bpo-43125: Fix: return expected type (str), not original value (bytes) in email/base64mime.py::body_encode Feb 9, 2021
@gst
Copy link
Contributor Author

gst commented Feb 9, 2021

@matrixise

my first PR ! :)

what's next ?

Copy link
Member

@corona10 corona10 left a comment

lgtm
but @serhiy-storchaka Can you please take a look also?

Lib/test/test_email/test_email.py Outdated Show resolved Hide resolved
@gst
Copy link
Contributor Author

gst commented Mar 3, 2021

@corona10 @serhiy-storchaka

I made the changes. what's next step ?

@@ -4261,7 +4261,7 @@ def test_decode(self):

def test_encode(self):
eq = self.assertEqual
eq(base64mime.body_encode(b''), b'')
eq(base64mime.body_encode(b''), '') # bpo-43125
Copy link
Member

@matrixise matrixise Mar 8, 2021

Choose a reason for hiding this comment

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

You don't need to add # bpo-43125

Copy link
Contributor Author

@gst gst Mar 8, 2021

Choose a reason for hiding this comment

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

fixed.

@bedevere-bot
Copy link

bedevere-bot commented Mar 8, 2021

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@gst
Copy link
Contributor Author

gst commented Mar 10, 2021

I have made the requested changes; please review again

@bedevere-bot
Copy link

bedevere-bot commented Mar 10, 2021

Thanks for making the requested changes!

@matrixise, @corona10: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested review from corona10 and matrixise Mar 10, 2021
@gst
Copy link
Contributor Author

gst commented Mar 19, 2021

@matrixise @corona10 ?

Copy link
Member

@corona10 corona10 left a comment

lgtm

@corona10 corona10 merged commit cf35e05 into python:master Mar 30, 2021
10 checks passed
kreathon pushed a commit to kreathon/cpython that referenced this pull request May 2, 2021
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.

None yet

5 participants