Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Feature Constructor: Compatibility with Python 3.8 #4222

Merged
merged 1 commit into from
Nov 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Orange/widgets/data/owfeatureconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,9 @@ def freevars(exp, env):
elif etype == ast.Starred:
# a 'starred' call parameter (e.g. a and b in `f(x, *a, *b)`
return freevars(exp.value, env)
elif etype in [ast.Num, ast.Str, ast.Ellipsis, ast.Bytes]:
elif etype in [ast.Num, ast.Str, ast.Ellipsis, ast.Bytes, ast.NameConstant]:
return []
elif etype == ast.NameConstant:
elif etype == ast.Constant:
return []
elif etype == ast.Attribute:
return freevars(exp.value, env)
Expand Down Expand Up @@ -836,9 +836,9 @@ def validate_exp(exp):
elif etype == ast.Starred:
assert isinstance(exp.ctx, ast.Load)
return validate_exp(exp.value)
elif etype in [ast.Num, ast.Str, ast.Bytes, ast.Ellipsis]:
elif etype in [ast.Num, ast.Str, ast.Bytes, ast.Ellipsis, ast.NameConstant]:
return True
elif etype == ast.NameConstant:
elif etype == ast.Constant:
return True
elif etype == ast.Attribute:
return True
Expand Down Expand Up @@ -947,6 +947,7 @@ def make_lambda(expression, args, env=None):
# lambda *{args}* : EXPRESSION
lambda_ = ast.Lambda(
args=ast.arguments(
posonlyargs=[],
args=[ast.arg(arg=arg, annotation=None) for arg in args],
varargs=None,
varargannotation=None,
Expand All @@ -961,6 +962,7 @@ def make_lambda(expression, args, env=None):
# lambda **{env}** : lambda *{args}*: EXPRESSION
outer = ast.Lambda(
args=ast.arguments(
posonlyargs=[],
args=[ast.arg(arg=name, annotation=None) for name in (env or {})],
varargs=None,
varargannotation=None,
Expand Down