changeset 551:4c968c5cfce6

Try to interpolate only if the length of the source string exceeds a minimum length
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 02 Jan 2022 16:05:35 +0100
parents 79db28e879f8
children 39e5d07d8dbc
files configmix/config.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configmix/config.py	Sun Jan 02 02:04:07 2022 +0100
+++ b/configmix/config.py	Sun Jan 02 16:05:35 2022 +0100
@@ -869,6 +869,9 @@
 
     def interpolate_variables(self, s):
         """Expand all variables in the single string `s`"""
+        len_s = len(s)
+        if len_s < 4:
+            return s
         start = s.find(_STARTTOK, 0)
         if start < 0:
             return s
@@ -883,7 +886,6 @@
                                "%r (cached)" % (s, ))
             else:
                 return res
-        len_s = len(s)
         res = []
         res_append = res.append
         rest = 0