Skip to content

Commit

Permalink
utils.str.perlReToReplacer: Return picklable function to String suppo…
Browse files Browse the repository at this point in the history
…rts py3.14
  • Loading branch information
progval committed Oct 19, 2024
1 parent d8fd887 commit ca91e94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/str.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ def perlReToReplacer(s):
flags = ''.join(flags)
r = perlReToPythonRe(sep.join(('', regexp, flags)))
if g:
return lambda s: r.sub(replace, s)
return functools.partial(r.sub, replace)
else:
return lambda s: r.sub(replace, s, 1)
return functools.partial(r.sub, replace, count=1)

_perlVarSubstituteRe = re.compile(r'\$\{([^}]+)\}|\$([a-zA-Z][a-zA-Z0-9]*)')
def perlVariableSubstitute(vars, text):
Expand Down

0 comments on commit ca91e94

Please sign in to comment.