From f636644d0cb840685fb3093d11e9b7dfa91593b2 Mon Sep 17 00:00:00 2001 From: AMin Date: Sun, 25 Oct 2026 18:26:11 +0800 Subject: [PATCH] Avoid uppercase ASCII labels in hostname strategies --- src/hyperlink/hypothesis.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hyperlink/hypothesis.py b/src/hyperlink/hypothesis.py index 4ab987eb..a116fa0d 100644 --- a/src/hyperlink/hypothesis.py +++ b/src/hyperlink/hypothesis.py @@ -15,7 +15,7 @@ else: from csv import reader as csv_reader from os.path import dirname, join - from string import ascii_letters, digits + from string import ascii_lowercase, digits from sys import maxunicode from typing import ( Callable, @@ -181,13 +181,14 @@ def hostname_labels(draw, allow_idn=True): label = label[:-1] else: + # IDNA's check_label rejects uppercase ASCII characters. label = cast( Text, draw( text( min_size=1, max_size=63, - alphabet=Text(ascii_letters + digits + u"-"), + alphabet=Text(ascii_lowercase + digits + u"-"), ) ), )