Slow IDNA encoding with large strings
Open
@encukou is already working on this.
Since Sep 17, 2026.
stdlib
type-feature
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
This is the opposite of #98433 which concerned IDNA decoding.
IDNA uses the quadratic-complexity codec punycode, making it slow with large inputs.
We do check the limit (64 bytes per label), but too late (after the quadratic step is done).
Note that #155475 added documentation warnings, urging users to limit the input size:
- https://docs.python.org/3/library/codecs.html#text-encodings
- https://docs.python.org/3/library/codecs.html#module-encodings.idna
Linked PRs
- gh-157682
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.