Skip to content

Commit 2a862b0

Browse files
committed
make our regex patterns __repr__ compatible to cpython
1 parent cdc28e5 commit 2a862b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

graalpython/lib-graalpython/_sre.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, pattern_input, isMatch, groupCount, start, end):
5858
self.groupCount = groupCount
5959
self._start = start
6060
self._end = end
61-
61+
6262
def getStart(self, grpidx):
6363
return self._start[grpidx]
6464

@@ -92,7 +92,7 @@ def fallback_compiler(pattern, flags):
9292
bit_flags = bit_flags | FLAGS[flag]
9393

9494
compiled_pattern = sre_compiler(pattern if mode == "str" else _str_to_bytes(pattern), bit_flags)
95-
95+
9696
# wraps a native 're.Pattern' object
9797
class ExecutablePattern:
9898
def __call__(self, *args):
@@ -297,7 +297,7 @@ def __repr__(self):
297297
else:
298298
sep = ", "
299299
sflags = "|".join(flag_items)
300-
return "re.compile(%s%s%s)" % (self.pattern, sep, sflags)
300+
return "re.compile(%r%s%s)" % (self.pattern, sep, sflags)
301301

302302
def _search(self, pattern, string, pos, endpos, sticky=False):
303303
pattern = self.__tregex_compile(pattern, self.flags_str + ("y" if sticky else ""))

0 commit comments

Comments
 (0)