From 57b0229421ad64fea6ba50a8628e6aedce017152 Mon Sep 17 00:00:00 2001 From: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> Date: Thu, 16 Jan 2025 20:01:11 +0100 Subject: [PATCH] [4.2.x] Refs #36098 -- Fixed validate_ipv4_address() crash for non-string values. Regression in ca2be7724e1244a4cb723de40a070f873c6e94bf. --- django/core/validators.py | 2 ++ 1 file changed, 2 insertions(+) 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: