[3.6] bpo-30605: Fix compiling binary regexs with BytesWarnings enabled. (GH-2016) (#2214)
Running our unit tests with `-bb` enabled triggered this failure..
(cherry picked from commit 171b9a354e816eebc6d4c3a8553303942e9c5025)
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index 608f9a2..b505e11 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -736,7 +736,7 @@
if not first or subpattern:
import warnings
warnings.warn(
- 'Flags not at the start of the expression %s%s' % (
+ 'Flags not at the start of the expression %r%s' % (
source.string[:20], # truncate long regexes
' (truncated)' if len(source.string) > 20 else '',
),