Commit ebbf1e67 authored by Ezio Melotti's avatar Ezio Melotti

#2650: Refactor re.escape to use enumerate().

parent 7b9e97b4
......@@ -223,8 +223,7 @@ def escape(pattern):
if isinstance(pattern, str):
alphanum = _alphanum_str
s = list(pattern)
for i in range(len(pattern)):
c = pattern[i]
for i, c in enumerate(pattern):
if c not in alphanum:
if c == "\000":
s[i] = "\\000"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment