mirror of
https://github.com/python/cpython.git
synced 2025-07-12 05:45:15 +00:00
Raise statement normalization in Lib/.
This commit is contained in:
parent
8b3febef2f
commit
ce36ad8a46
80 changed files with 502 additions and 530 deletions
|
@ -69,7 +69,7 @@ def _compile(code, pattern, flags):
|
|||
emit(OPCODES[ANY])
|
||||
elif op in REPEATING_CODES:
|
||||
if flags & SRE_FLAG_TEMPLATE:
|
||||
raise error, "internal: unsupported template operator"
|
||||
raise error("internal: unsupported template operator")
|
||||
emit(OPCODES[REPEAT])
|
||||
skip = _len(code); emit(0)
|
||||
emit(av[0])
|
||||
|
@ -118,7 +118,7 @@ def _compile(code, pattern, flags):
|
|||
else:
|
||||
lo, hi = av[1].getwidth()
|
||||
if lo != hi:
|
||||
raise error, "look-behind requires fixed-width pattern"
|
||||
raise error("look-behind requires fixed-width pattern")
|
||||
emit(lo) # look behind
|
||||
_compile(code, av[1], flags)
|
||||
emit(OPCODES[SUCCESS])
|
||||
|
@ -179,7 +179,7 @@ def _compile(code, pattern, flags):
|
|||
else:
|
||||
code[skipyes] = _len(code) - skipyes + 1
|
||||
else:
|
||||
raise ValueError, ("unsupported operand type", op)
|
||||
raise ValueError("unsupported operand type", op)
|
||||
|
||||
def _compile_charset(charset, flags, code, fixup=None):
|
||||
# compile charset subprogram
|
||||
|
@ -207,7 +207,7 @@ def _compile_charset(charset, flags, code, fixup=None):
|
|||
else:
|
||||
emit(CHCODES[av])
|
||||
else:
|
||||
raise error, "internal: unsupported set operator"
|
||||
raise error("internal: unsupported set operator")
|
||||
emit(OPCODES[FAILURE])
|
||||
|
||||
def _optimize_charset(charset, fixup):
|
||||
|
@ -362,7 +362,7 @@ def _simple(av):
|
|||
# check if av is a "simple" operator
|
||||
lo, hi = av[2].getwidth()
|
||||
if lo == 0 and hi == MAXREPEAT:
|
||||
raise error, "nothing to repeat"
|
||||
raise error("nothing to repeat")
|
||||
return lo == hi == 1 and av[2][0][0] != SUBPATTERN
|
||||
|
||||
def _compile_info(code, pattern, flags):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue