Skip to content

bpo-44660: Updated email.feedparser with support for message/global emails with quoted-printable and base64 Content-Transfer-Encodings.#27208

Draft
f18a14c09s wants to merge 8 commits into
python:mainfrom
f18a14c09s:fix-issue-44660
Draft

bpo-44660: Updated email.feedparser with support for message/global emails with quoted-printable and base64 Content-Transfer-Encodings.#27208
f18a14c09s wants to merge 8 commits into
python:mainfrom
f18a14c09s:fix-issue-44660

Conversation

@f18a14c09s

@f18a14c09s f18a14c09s commented Jul 17, 2021

Copy link
Copy Markdown

Fixed issue 44660: email.feedparser Module Lacks Support for Section 3.5 of RFC 6532: message/global Emails with non-identity Content-Transfer-Encodings as follows:
Added message/global Content-Transfer-Encoding section to _parsegen function; three supporting classes; and a supporting function.
Added unit test coverage for the subject scenarios.

https://bugs.python.org/issue44660

Added message/global Content-Transfer-Encoding section to _parsegen function, three supporting classes, and a supporting function.
Added parsing coverage for base64 and quoted-printable Content-Transfer-Encodings.
@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@f18a14c09s

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@jdevries3133 jdevries3133 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very nice!

Comment thread Lib/email/feedparser.py


class NonIdentityTransferDecodingFeedParser(abc.ABC):
"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hanging indent on the docstring looks strange to me; consult PEP 257

Comment thread Lib/email/feedparser.py Outdated

class Base64TransferDecodingFeedParser(NonIdentityTransferDecodingFeedParser):
"""
Concrete, "base64" implementation of TransferDecodingFeedParser.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This docstring, and the docstring for QuotedPrintableTransferDecodingFeedParser seem redundant. Seeing as the class and base class names are quite descriptive, maybe just provide an RFC (or other) citation in the docstrings?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks, I incorporated the recommendation in a massive update I'm about to apply.

Comment thread Lib/email/feedparser.py Outdated
Creates a new FeedParser object that transparently reverses the specified
content_transfer_encoding transformation.
:param content_transfer_encoding: str
:return: Union[NoneType,NonIdentityTransferDecodingFeedParser] None if

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you're going to provide this information, use type hints:

def _new_transfer_decoding_parser(content_transfer_encoding: str, **kwargs
    ) -> Union[NoneType, NonIdentityTransferDecodingFeedParser]: 

Formatting is tricky because the bass class name is so long. Maybe consider shortening it a bit: NoIdTransDecodingFP. I don't really love that abbreviation myself and I like the current descriptive name, but it is quite a mouthful.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks, I incorporated the recommendation in a massive update I'm about to apply.

Replaced decoding-parser factory method with Content-Transfer-Encoding (str) to factory (function) map.
Removed the word "transfer" from the TransferDecoding-related classes, functions, variables, etc. to be more concise and because there is already sufficient context.
Removed the word "nonidentity" from class NonIdentityTransferDecodingFeedParser's name and updated the docstrings/comments explaining why the word is redundant.
Moved base-64-only functionality to new class in base64mime sub-package.
Accounted for edge cases in QuotedPrintableFeedParser so that it could be made a standalone feature if desired.
Added/updated code comments.
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Aug 18, 2021
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 10, 2022
@python-cla-bot

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA signed

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants