From 39a34d4bf94bc8325119bc23b64f3a041a85dd2d Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Mon, 28 Oct 2019 11:40:09 +0100 Subject: [PATCH] Refs #30899 -- Made _lazy_re_compile() support bytes. --- django/utils/regex_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/utils/regex_helper.py b/django/utils/regex_helper.py index e910cac4aa..8612475b96 100644 --- a/django/utils/regex_helper.py +++ b/django/utils/regex_helper.py @@ -341,7 +341,7 @@ def _lazy_re_compile(regex, flags=0): """Lazily compile a regex with flags.""" def _compile(): # Compile the regex if it was not passed pre-compiled. - if isinstance(regex, str): + if isinstance(regex, (str, bytes)): return re.compile(regex, flags) else: assert not flags, (