]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Uses re.compile flags argument, not inline flags (#628)
authorjfinkels <jfinkels@users.noreply.github.com>
Sun, 25 Dec 2016 23:10:33 +0000 (18:10 -0500)
committerDavid Lord <davidism@gmail.com>
Sun, 25 Dec 2016 23:10:33 +0000 (15:10 -0800)
This commit replaces the use of terminal inline flags in a regular
expression in `re.compile`,

    re.compile(r'\w+(?u)')

with arguments to the `re.compile` function itself,

    re.compile(r'\w+', re.UNICODE)

because the former is deprecated as of Python 3.6.

jinja2/filters.py

index a450406941bfb55ff00fddd22d0bf90823d6414f..b5fa456f304cb42f14f6dae6b231ee9e472677dc 100644 (file)
@@ -21,8 +21,8 @@ from jinja2.exceptions import FilterArgumentError
 from jinja2._compat import imap, string_types, text_type, iteritems
 
 
-_word_re = re.compile(r'\w+(?u)')
-_word_beginning_split_re = re.compile(r'([-\s\(\{\[\<]+)(?u)')
+_word_re = re.compile(r'\w+', re.UNICODE)
+_word_beginning_split_re = re.compile(r'([-\s\(\{\[\<]+)', re.UNICODE)
 
 
 def contextfilter(f):