#36664: Python 3.15 compatibility.
-------------------------------------+-------------------------------------
     Reporter:  Mariusz Felisiak     |                    Owner:  Mariusz
                                     |  Felisiak
         Type:  New feature          |                   Status:  assigned
    Component:  Core (Other)         |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Someday/Maybe
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Mike Edmunds):

 Replying to [comment:5 Jacob Walls]:
 > We have on the 3.15 builds:
 >
 > {{{#!text
 > ERROR: test_rejects_non_ascii_local_part
 (mail.test_backends.SMTPBackendTests.test_rejects_non_ascii_local_part)
 > The SMTP EmailBackend does not currently support non-ASCII local-parts.
 > }}}
 >
 > [...]
 >
 > Should we be catching `email.errors.HeaderWriteError` and re-raising in
 the code, or should we be adjusting the test for 3.15? And should we do
 anything about the `if not force_ascii:` branch for now? Appreciate your
 advice.

 I'll open a PR to update the test. I ''think'' the right approach to
 catching unsupported non-ASCII email usernames is:

 * Let stdlib email report the problem when it's capable (i.e., 3.15+), as
 a `HeaderWriteError: Non-ASCII local-part … is invalid under current
 policy`. I know we try to avoid testing stdlib behavior, but given the
 upstream flux in this area we might want to ensure ''something'' useful
 gets reported to the user (without pinning our tests to the precise stdlib
 error).
 * Continue to raise (and test) our own `ValueError` in `prep_address()` if
 stdlib email would incorrectly encode the email as something undeliverable
 (i.e., before 3.15; there are currently no plans to backport the bugfix
 from 3.15 due to compatibility concerns).

 > It fails more informatively when I remove `spec=object()`:

 There's actually no need for that test to mock the smtplib connection in
 the first place; I'll remove it.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36664#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019e225356e6-cec5e1ff-214b-4b69-a275-38e4eb7d3c0e-000000%40eu-central-1.amazonses.com.

Reply via email to