Ah, this is probably a one-time thing only, since file /usr/lib/python3.12/email/errors.py actually already contains that Python fix on my system:
------------------------- snip ------------------------- [...] class CharsetError(MessageError): """An illegal charset was given.""" class HeaderWriteError(MessageError): """Error while writing headers.""" # These are parsing defects which the parser was able to work around. class MessageDefect(ValueError): [...] ------------------------- snip ------------------------- Leaving it to you whether you'd like to do something about this issue or not. For the record, the order of the package upgrades done by unattended-upgrade during the run where sending mail failed was as follows: ------------------------- snip ------------------------- [...] Log started: 2024-09-18 10:51:15 (Reading database ... 101329 files and directories currently installed.) Preparing to unpack .../python3.12-venv_3.12.6-1_amd64.deb ... Unpacking python3.12-venv (3.12.6-1) over (3.12.4-3) ... Preparing to unpack .../libpython3.12t64_3.12.6-1_amd64.deb ... Unpacking libpython3.12t64:amd64 (3.12.6-1) over (3.12.4-3) ... Preparing to unpack .../libssl3t64_3.3.2-1_amd64.deb ... Unpacking libssl3t64:amd64 (3.3.2-1) over (3.2.2-1) ... Selecting previously unselected package openssl-provider-legacy. Preparing to unpack .../openssl-provider-legacy_3.3.2-1_amd64.deb ... Unpacking openssl-provider-legacy (3.3.2-1) ... Setting up libssl3t64:amd64 (3.3.2-1) ... Setting up openssl-provider-legacy (3.3.2-1) ... (Reading database ... 101333 files and directories currently installed.) Preparing to unpack .../python3.12_3.12.6-1_amd64.deb ... Unpacking python3.12 (3.12.6-1) over (3.12.4-3) ... Preparing to unpack .../libpython3.12-stdlib_3.12.6-1_amd64.deb ... Unpacking libpython3.12-stdlib:amd64 (3.12.6-1) over (3.12.4-3) ... Preparing to unpack .../python3.12-minimal_3.12.6-1_amd64.deb ... Unpacking python3.12-minimal (3.12.6-1) over (3.12.4-3) ... Preparing to unpack .../libpython3.12-minimal_3.12.6-1_amd64.deb ... Unpacking libpython3.12-minimal:amd64 (3.12.6-1) over (3.12.4-3) ... Preparing to unpack .../openssl_3.3.2-1_amd64.deb ... Unpacking openssl (3.3.2-1) over (3.2.2-1) ... Setting up libpython3.12-minimal:amd64 (3.12.6-1) ... Setting up openssl (3.3.2-1) ... Installing new version of config file /etc/ssl/openssl.cnf ... Setting up python3.12-minimal (3.12.6-1) ... Setting up libpython3.12-stdlib:amd64 (3.12.6-1) ... Setting up python3.12 (3.12.6-1) ... Setting up libpython3.12t64:amd64 (3.12.6-1) ... Setting up python3.12-venv (3.12.6-1) ... Processing triggers for systemd (256.5-1) ... Processing triggers for man-db (2.12.1-3) ... Processing triggers for desktop-file-utils (0.27-2) ... Processing triggers for libc-bin (2.39-7) ... Log ended: 2024-09-18 10:51:19 [...] Log started: 2024-09-18 10:53:14 Preconfiguring packages ... Preconfiguring packages ... (Reading database ... 101505 files and directories currently installed.) Preparing to unpack .../unattended-upgrades_2.11+nmu1_all.deb ... Unpacking unattended-upgrades (2.11+nmu1) over (2.11) ... dpkg: warning: unable to delete old directory '/lib/systemd/system-sleep': Directory not empty Setting up unattended-upgrades (2.11+nmu1) ... Processing triggers for man-db (2.12.1-3) ... Log ended: 2024-09-18 10:53:15 [...] ------------------------- snip -------------------------