From 27be007d9b4a05d3a0104a048cefc8c85cafd630 Mon Sep 17 00:00:00 2001 From: izveigor Date: Thu, 11 Aug 2022 19:59:41 +0300 Subject: [PATCH] Removed checks of useless keys by the property of sorted elements --- src/flask/config.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/flask/config.py b/src/flask/config.py index 7b6a137a..a6dadd8d 100644 --- a/src/flask/config.py +++ b/src/flask/config.py @@ -127,10 +127,16 @@ class Config(dict): prefix = f"{prefix}_" len_prefix = len(prefix) + variables = list() + is_found = False for key in sorted(os.environ): - if not key.startswith(prefix): - continue + if key.startswith(prefix): + is_found = True + variables.append(key) + elif is_found: + break + for key in variables: value = os.environ[key] try: