diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-25 19:03:47 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-25 19:03:47 (GMT) |
commit | 632a77e6a3fb3acec9850cd5245dc28314000e54 (patch) | |
tree | 2f3d5fb838d0fad895465a63a1fcc767c4f52bf9 /Lib/sre_compile.py | |
parent | 7c316a181a38d97a1af7da8199c5b6dfcb25b450 (diff) | |
download | cpython-632a77e6a3fb3acec9850cd5245dc28314000e54.zip cpython-632a77e6a3fb3acec9850cd5245dc28314000e54.tar.gz cpython-632a77e6a3fb3acec9850cd5245dc28314000e54.tar.bz2 |
Issue #22364: Improved some re error messages using regex for hints.
Diffstat (limited to 'Lib/sre_compile.py')
-rw-r--r-- | Lib/sre_compile.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index 30a5fae..502b061 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): |