summaryrefslogtreecommitdiff
path: root/Lib/sre_compile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-25 21:03:47 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-25 21:03:47 +0200
commit632a77e6a3fb3acec9850cd5245dc28314000e54 (patch)
tree2f3d5fb838d0fad895465a63a1fcc767c4f52bf9 /Lib/sre_compile.py
parent7c316a181a38d97a1af7da8199c5b6dfcb25b450 (diff)
downloadcpython-git-632a77e6a3fb3acec9850cd5245dc28314000e54.tar.gz
Issue #22364: Improved some re error messages using regex for hints.
Diffstat (limited to 'Lib/sre_compile.py')
-rw-r--r--Lib/sre_compile.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
index 30a5fae485..502b0616c6 100644
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -113,7 +113,7 @@ def _compile(code, pattern, flags):
emit(ANY)
elif op in REPEATING_CODES:
if flags & SRE_FLAG_TEMPLATE:
- raise error("internal: unsupported template operator")
+ raise error("internal: unsupported template operator %r" % (op,))
elif _simple(av) and op is not REPEAT:
if op is MAX_REPEAT:
emit(REPEAT_ONE)
@@ -216,7 +216,7 @@ def _compile(code, pattern, flags):
else:
code[skipyes] = _len(code) - skipyes + 1
else:
- raise ValueError("unsupported operand type", op)
+ raise error("internal: unsupported operand type %r" % (op,))
def _compile_charset(charset, flags, code, fixup=None, fixes=None):
# compile charset subprogram
@@ -242,7 +242,7 @@ def _compile_charset(charset, flags, code, fixup=None, fixes=None):
else:
emit(av)
else:
- raise error("internal: unsupported set operator")
+ raise error("internal: unsupported set operator %r" % (op,))
emit(FAILURE)
def _optimize_charset(charset, fixup, fixes):