8000 BUG: add fix for Python 2.6 compatibility · matplotlib/matplotlib@d9f02a9 · GitHub
[go: up one dir, main page]

Skip to content

Commit d9f02a9

Browse files
committed
BUG: add fix for Python 2.6 compatibility
re.flags argument to re.sub appears to a 2.7 innovation.
1 parent 4872619 commit d9f02a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ def remove_coding(text):
334334
"""
335335
Remove the coding comment, which six.exec_ doesn't like.
336336
"""
337-
return re.sub(
338-
"^#\s*-\*-\s*coding:\s*.*-\*-$", "", text, flags=re.MULTILINE)
337+
sub_re = re.compile("^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
338+
return sub_re.sub("", text)
339339

340340
#------------------------------------------------------------------------------
341341
# Template

0 commit comments

Comments
 (0)
0