python / python/cpython

Slow IDNA encoding with large strings

Open
#157,675 0 comments 0 reactions 1 assignee View on GitHub

@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:

Linked PRs
  • gh-157682

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.