mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #22364: Improved some re error messages using regex for hints.
This commit is contained in:
parent
7c316a181a
commit
632a77e6a3
6 changed files with 299 additions and 195 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue