Skip to content

Commit 08b6235

Browse files
crazyengRaj Balaebail
authored andcommitted
adding fix for python 3.8
# https://bugs.python.org/issue35766 # https://bugs.python.org/issue35894 # ipython/ipython#11590 # PY_38 requires type_ignores to be a list, other versions are not accepting a second argument
1 parent 7f32c35 commit 08b6235

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

wolframclient/utils/externalevaluate.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@
2727

2828
EXPORT_KWARGS = {"target_format": "wxf", "allow_external_objects": True}
2929

30+
if six.PY_38:
31+
32+
# https://bugs.python.org/issue35766
33+
# https://bugs.python.org/issue35894
34+
# https://github.com/ipython/ipython/issues/11590
35+
# PY_38 requires type_ignores to be a list, other versions are not accepting a second argument
36+
37+
def Module(code):
38+
return ast.Module(code, [])
39+
40+
41+
else:
42+
43+
def Module(code):
44+
return ast.Module(code)
45+
3046

3147
def EvaluationEnvironment(code, session_data={}, constants=None, **extra):
3248

@@ -70,7 +86,7 @@ def execute_from_string(code, globals={}, **opts):
7086
result = expressions.pop(-1)
7187

7288
if expressions:
73-
exec(compile(ast.Module(expressions), "", "exec"), env)
89+
exec(compile(Module(expressions), "", "exec"), env)
7490

7591
if result:
7692
return eval(compile(ast.Expression(result.value), "", "eval"), env)

wolframclient/utils/six.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
PY_35 = sys.version_info >= (3, 5)
1515
PY_36 = sys.version_info >= (3, 6)
1616
PY_37 = sys.version_info >= (3, 7)
17+
PY_38 = sys.version_info >= (3, 8)
1718

1819
WINDOWS = platform.system() == "Windows"
1920
LINUX = platform.system() == "Linux"

0 commit comments

Comments
 (0)