From 1712862b7e9405c580f04a82eaed3603debcec13 Mon Sep 17 00:00:00 2001 From: Ben Griffin Date: Thu, 5 Mar 2020 11:54:58 +0000 Subject: [PATCH] This now checks for _iter_ instead, but also ignores strings. --- Lib/configparser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/configparser.py b/Lib/configparser.py index 355fc9daf3a..2ffd3f34d6a 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -1143,8 +1143,9 @@ class RawConfigParser(MutableMapping): """ var_dict = {} + section_is_iterable = not isinstance(section, str) and hasattr(section, '__iter__') + section_list = section if section_is_iterable else [section] - section_list = section if hasattr(section, '__iter__') else [section] map_list = [] if vars: