Skip to content

Commit

Permalink
Fix failure to use fallback for getlist
Browse files Browse the repository at this point in the history
aqt.helper.MyConfigParser.getlist fails to retrieve a fallback list when
the `section` parameter does not exist in the `settings.ini` file.
This ensures that the fallback is used when that key is missing.
  • Loading branch information
ddalcino committed Mar 7, 2022
1 parent 5a7adb6 commit 12d20a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aqt/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ def xml_to_modules(

class MyConfigParser(configparser.ConfigParser):
def getlist(self, section: str, option: str, fallback=[]) -> List[str]:
value = self.get(section, option)
value = self.get(section, option, fallback=None)
if value is None:
return fallback
try:
result = list(filter(None, (x.strip() for x in value.splitlines())))
except Exception:
Expand Down

0 comments on commit 12d20a3

Please sign in to comment.