Message413229
Importing the idna encoding has a significant time and memory cost. Therefore, the standard library tries to avoid importing it when it's not needed (i.e. when the domain name is already pure ASCII), e.g. in Lib/http/client.py and Modules/socketmodule.c with `idna_converter`.
However, there are code paths that still attempt to encode or decode as idna unconditionally, in particular Lib/ssl.py and _socket.getaddrinfo. Here's a one-line test case:
python3 -c "import sys, urllib.request; urllib.request.urlopen('https://www.google.com'); assert 'encodings.idna' not in sys.modules"
These code paths can be converted using existing code to do the import conditionally (I'll send a PR). |
|
Date |
User |
Action |
Args |
2022-02-14 15:55:15 | slingamn | set | recipients:
+ slingamn, christian.heimes |
2022-02-14 15:55:15 | slingamn | set | messageid: <1644854115.6.0.132786473021.issue46750@roundup.psfhosted.org> |
2022-02-14 15:55:15 | slingamn | link | issue46750 messages |
2022-02-14 15:55:15 | slingamn | create | |
|