diff --git a/lib/parsec/validate.py b/lib/parsec/validate.py index 2843affd2b9..ad60f8a7c4d 100644 --- a/lib/parsec/validate.py +++ b/lib/parsec/validate.py @@ -381,8 +381,12 @@ def strip_and_unquote_list(cls, keys, value): Processed value as a list. """ if value.startswith('"') or value.startswith("'"): - lexer = shlex.shlex(value, posix=True) - values = [t for t in lexer if t != ","] + lexer = shlex.shlex(value, posix=True, punctuation_chars=",") + lexer.commenters = '#' + lexer.whitespace_split = False + lexer.whitespace = "\t\n\r" + lexer.wordchars += " " + values = [t.strip() for t in lexer if t != ","] else: # unquoted values (may contain internal quoted strings with list # delimiters inside 'em!)