0
0
mirror of https://github.com/django/django.git synced 2024-11-29 14:46:18 +01:00

Refs #30899 -- Made _lazy_re_compile() support bytes.

This commit is contained in:
Hasan Ramezani 2019-10-28 11:40:09 +01:00 committed by Mariusz Felisiak
parent c4cba148d8
commit 39a34d4bf9

View File

@ -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, (