diff options
author | Jelle Licht <jlicht@fsfe.org> | 2020-09-05 20:41:21 +0200 |
---|---|---|
committer | Jelle Licht <jlicht@fsfe.org> | 2020-09-05 20:41:21 +0200 |
commit | 799177d651e59c7186ea4ee4346d4dd6e4a174b2 (patch) | |
tree | f1b40af6004c8393db1875e46802c7c46908db4e | |
parent | c084caf492e840991f7367063291d068461f8a4d (diff) | |
download | yt-local-799177d651e59c7186ea4ee4346d4dd6e4a174b2.tar.lz yt-local-799177d651e59c7186ea4ee4346d4dd6e4a174b2.tar.xz yt-local-799177d651e59c7186ea4ee4346d4dd6e4a174b2.zip |
settings.py: Support newer `ast.Constant' for settings.txt file.
In python 3.8, specific constant AST types are removed in favor of
ast.Constant. This change should work for both cases. See
https://bugs.python.org/issue32892 for the given rationale.
-rw-r--r-- | settings.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/settings.py b/settings.py index 517e785..7e988f7 100644 --- a/settings.py +++ b/settings.py @@ -235,6 +235,7 @@ else: # parse settings in a safe way, without exec settings = {} attributes = { + ast.Constant: 'value', ast.NameConstant: 'value', ast.Num: 'n', ast.Str: 's', @@ -258,7 +259,7 @@ else: log_ignored_line(node.lineno, target.id + " is not a valid setting") continue - if type(node.value) not in (ast.NameConstant, ast.Num, ast.Str): + if type(node.value) not in attributes: log_ignored_line(node.lineno, "only literals allowed for values") continue |