gh-139434: Update selected RFC 2822 references to RFC 5322 (#139435)

Update selected RFC 2822 references to RFC 5322

RFC 2822 was obsoleted by RFC 5322 in 2008. This updates references
to use the current standard in documentation, docstrings, and comments.

It preserves RFC 2822 references in legacy API components to maintain their
historical context.

RFC 822 → RFC 2822 → RFC 5322 progression is explained where relevant.

In some places specific sections of RFC are referenced where it seems helpful.

Scout rule was applied in some places and RFC mentions format was
normalized in doc strings and comments.
This commit is contained in:
Filip Łajszczak 2025-11-04 20:46:07 +01:00 committed by GitHub
parent 97d8dda980
commit ce1bb85d28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 49 additions and 45 deletions

View file

@ -2,7 +2,7 @@
# Author: Barry Warsaw, Thomas Wouters, Anthony Baxter
# Contact: email-sig@python.org
"""A parser of RFC 2822 and MIME email messages."""
"""A parser of RFC 5322 and MIME email messages."""
__all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser',
'FeedParser', 'BytesFeedParser']
@ -15,13 +15,13 @@
class Parser:
def __init__(self, _class=None, *, policy=compat32):
"""Parser of RFC 2822 and MIME email messages.
"""Parser of RFC 5322 and MIME email messages.
Creates an in-memory object tree representing the email message, which
can then be manipulated and turned over to a Generator to return the
textual representation of the message.
The string must be formatted as a block of RFC 2822 headers and header
The string must be formatted as a block of RFC 5322 headers and header
continuation lines, optionally preceded by a 'Unix-from' header. The
header block is terminated either by the end of the string or by a
blank line.
@ -75,13 +75,13 @@ def parsestr(self, text, headersonly=True):
class BytesParser:
def __init__(self, *args, **kw):
"""Parser of binary RFC 2822 and MIME email messages.
"""Parser of binary RFC 5322 and MIME email messages.
Creates an in-memory object tree representing the email message, which
can then be manipulated and turned over to a Generator to return the
textual representation of the message.
The input must be formatted as a block of RFC 2822 headers and header
The input must be formatted as a block of RFC 5322 headers and header
continuation lines, optionally preceded by a 'Unix-from' header. The
header block is terminated either by the end of the input or by a
blank line.