﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36007	Dead code in URLValidator	Mike Edmunds	Mike Edmunds	"There's some dead code in django.core.validators.URLValidator which could be removed:

* The entire [https://github.com/django/django/blob/6f38697f90a14f1450a71c1e40aea0f5df7dca86/django/core/validators.py#L183-L193 ""Trivial case failed. Try for possible IDN domain""] section is no longer useful. This code attempts to re-validate a failed URL after encoding an international domain name using IDNA 2003 (""punycode""). But the URLValidator regular expressions have allowed ''all'' IDNs since [https://github.com/django/django/commit/2e65d56156b622e2393dee1af66e9c799a51924f Commit 2e65d56] (for #20003, in 2015), so the super call will never fail with a validation error that switching to IDNA 2003 would let pass.

* The [https://github.com/django/django/blob/6f38697f90a14f1450a71c1e40aea0f5df7dca86/django/core/validators.py#L131 `ul` unicode letters property] is no longer used. The regular expressions that had used it were moved into DomainNameValidator in [https://github.com/django/django/commit/4971a9afe5642569f3dcfcd3972ebb39e88dd457 Commit 4971a9a] (for #18119, in Django 5.1).

For the first case, one way to verify the code is no longer in use is to run URLValidator on `https://މިހާރު.com`, which is a domain allowed by IDNA 2008 but prohibited by IDNA 2003. If the punycode() branch were coming into play, that URL would be rejected:

{{{#!python
from django.core.validators import URLValidator
URLValidator()(""https://މިހާރު.com"")
# (No error)

from django.utils.encoding import punycode
punycode(""މިހާރު.com"")
# UnicodeError: Violation of BIDI requirement 3
# encoding with 'idna' codec failed
}}}
"	Cleanup/optimization	closed	Core (Other)	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
