Skip to content

Commit e606239

Browse files
Merge branch 'main' into frame-pointers
2 parents 7695f4c + b605573 commit e606239

27 files changed

Lines changed: 1484 additions & 1118 deletions

Doc/library/email.policy.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,26 @@ added matters. To illustrate::
403403
.. attribute:: utf8
404404

405405
If ``False``, follow :rfc:`5322`, supporting non-ASCII characters in
406-
headers by encoding them as "encoded words". If ``True``, follow
407-
:rfc:`6532` and use ``utf-8`` encoding for headers. Messages
406+
headers by encoding them as :rfc:`2047` "encoded words". If ``True``,
407+
follow :rfc:`6532` and use ``utf-8`` encoding for headers. Messages
408408
formatted in this way may be passed to SMTP servers that support
409409
the ``SMTPUTF8`` extension (:rfc:`6531`).
410410

411+
When ``False``, the generator will raise
412+
:exc:`~email.errors.HeaderWriteError` if any header includes non-ASCII
413+
characters in a context where :rfc:`2047` does not permit encoded words.
414+
This particularly applies to mailboxes ("addr-spec") with non-ASCII
415+
characters, which can be created via
416+
:class:`~email.headerregistry.Address`. To use a mailbox with a non-ASCII
417+
domain name with ``utf8=False``, first encode the domain using the
418+
third-party :pypi:`idna` or :pypi:`uts46` module or with
419+
:mod:`encodings.idna`. It is not possible to use a non-ASCII username
420+
("local-part") in a mailbox when ``utf8=False``.
421+
422+
.. versionchanged:: 3.15
423+
Can trigger the raising of :exc:`~email.errors.HeaderWriteError`.
424+
(Earlier versions incorrectly applied :rfc:`2047` in certain contexts,
425+
mostly notably in addr-specs.)
411426

412427
.. attribute:: refold_source
413428

Doc/whatsnew/3.15.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,16 @@ faulthandler
915915
(Contributed by Eric Froemling in :gh:`149085`.)
916916

917917

918+
email
919+
-----
920+
921+
* Email generators now raise an error when an :class:`.EmailMessage` cannot be
922+
accurately flattened due to a non-ASCII email address (mailbox) in an address
923+
header. Options for supporting Email Address Internationalization (EAI) are
924+
discussed in :attr:`.EmailPolicy.utf8`.
925+
(Contributed by R David Murray and Mike Edmunds in :gh:`122540`.)
926+
927+
918928
functools
919929
---------
920930

Include/internal/pycore_interp_structs.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,13 @@ struct _py_func_state {
525525
/****** type state *********/
526526

527527
/* For now we hard-code this to a value for which we are confident
528-
all the static builtin types will fit (for all builds). */
529-
#define _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES 203
528+
all the static builtin types will fit (for all builds).
529+
If you add a new static type to the standard library, you may have to
530+
update one of these numbers.
531+
*/
532+
#define _Py_NUM_MANAGED_PREINITIALIZED_TYPES 120
533+
#define _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES \
534+
(_Py_NUM_MANAGED_PREINITIALIZED_TYPES + 83)
530535
#define _Py_MAX_MANAGED_STATIC_EXT_TYPES 10
531536
#define _Py_MAX_MANAGED_STATIC_TYPES \
532537
(_Py_MAX_MANAGED_STATIC_BUILTIN_TYPES + _Py_MAX_MANAGED_STATIC_EXT_TYPES)

0 commit comments

Comments
 (0)