This commit is contained in:
James Taylor 2020-09-05 23:49:28 -07:00
commit 3a8f18a1fd
2 changed files with 3 additions and 1 deletions

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
from gevent import monkey from gevent import monkey
monkey.patch_all() monkey.patch_all()
import gevent.socket import gevent.socket

View File

@ -235,6 +235,7 @@ else:
# parse settings in a safe way, without exec # parse settings in a safe way, without exec
settings = {} settings = {}
attributes = { attributes = {
ast.Constant: 'value',
ast.NameConstant: 'value', ast.NameConstant: 'value',
ast.Num: 'n', ast.Num: 'n',
ast.Str: 's', ast.Str: 's',
@ -258,7 +259,7 @@ else:
log_ignored_line(node.lineno, target.id + " is not a valid setting") log_ignored_line(node.lineno, target.id + " is not a valid setting")
continue 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") log_ignored_line(node.lineno, "only literals allowed for values")
continue continue