summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-16 20:01:11 +0100
committerGitHub <noreply@github.com>2025-01-16 16:01:11 -0300
commit57b0229421ad64fea6ba50a8628e6aedce017152 (patch)
treec491e6156635a033477bccd201d799b447f2ffba
parent043dfadbcebc752d5ab2e9ff08c7e48044d20dc2 (diff)
[4.2.x] Refs #36098 -- Fixed validate_ipv4_address() crash for non-string values.
Regression in ca2be7724e1244a4cb723de40a070f873c6e94bf.
-rw-r--r--django/core/validators.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/core/validators.py b/django/core/validators.py
index 4a5835dbb0..c588603938 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -272,6 +272,8 @@ validate_unicode_slug = RegexValidator(
def validate_ipv4_address(value):
+ if isinstance(value, ipaddress.IPv4Address):
+ return
try:
ipaddress.IPv4Address(value)
except ValueError: