summaryrefslogtreecommitdiffstats
path: root/Lib/sre_parse.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r--Lib/sre_parse.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index 4a77f0c..3d38673 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -735,8 +735,13 @@ def _parse(source, state, verbose):
if flags is None: # global flags
if pos != 3: # "(?x"
import warnings
- warnings.warn('Flags not at the start of the expression',
- DeprecationWarning, stacklevel=7)
+ warnings.warn(
+ 'Flags not at the start of the expression %s%s' % (
+ source.string[:20], # truncate long regexes
+ ' (truncated)' if len(source.string) > 20 else '',
+ ),
+ DeprecationWarning, stacklevel=7
+ )
continue
add_flags, del_flags = flags
group = None