gh-133306: Use \z instead of \Z in fnmatch.translate() and glob.translate() (GH-133338)

This commit is contained in:
Serhiy Storchaka 2025-05-03 17:58:21 +03:00 committed by GitHub
parent cb3174113e
commit add0ca9ea0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 96 additions and 94 deletions

View file

@ -185,7 +185,7 @@ def _translate(pat, star, question_mark):
def _join_translated_parts(parts, star_indices):
if not star_indices:
return fr'(?s:{"".join(parts)})\Z'
return fr'(?s:{"".join(parts)})\z'
iter_star_indices = iter(star_indices)
j = next(iter_star_indices)
buffer = parts[:j] # fixed pieces at the start
@ -206,4 +206,4 @@ def _join_translated_parts(parts, star_indices):
append('.*')
extend(parts[i:])
res = ''.join(buffer)
return fr'(?s:{res})\Z'
return fr'(?s:{res})\z'