From 9a8e7fd98c7a85e593b69cd2f44ef9c1ed037544 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 19 Oct 2024 07:53:00 +0200 Subject: [PATCH] utils.str.perlReToReplacer: Return picklable function to String supports py3.14 --- src/utils/str.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/str.py b/src/utils/str.py index c9a86c21e..5fe7ae943 100644 --- a/src/utils/str.py +++ b/src/utils/str.py @@ -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):