Show More
@@ -791,9 +791,6 b' class MaybeAsyncCommandCompiler(CommandCompiler):' | |||||
791 | self.compiler = MaybeAsyncCompile(extra_flags=extra_flags) |
|
791 | self.compiler = MaybeAsyncCompile(extra_flags=extra_flags) | |
792 |
|
792 | |||
793 |
|
793 | |||
794 | if (sys.version_info.major, sys.version_info.minor) >= (3, 8): |
|
794 | _extra_flags = ast.PyCF_ALLOW_TOP_LEVEL_AWAIT | |
795 | _extra_flags = ast.PyCF_ALLOW_TOP_LEVEL_AWAIT |
|
|||
796 | else: |
|
|||
797 | _extra_flags = ast.PyCF_ONLY_AST |
|
|||
798 |
|
795 | |||
799 | compile_command = MaybeAsyncCommandCompiler(extra_flags=_extra_flags) |
|
796 | compile_command = MaybeAsyncCommandCompiler(extra_flags=_extra_flags) |
@@ -8,49 +8,44 b'' | |||||
8 | import ast |
|
8 | import ast | |
9 | import bdb |
|
9 | import bdb | |
10 | import builtins as builtin_mod |
|
10 | import builtins as builtin_mod | |
|
11 | import cProfile as profile | |||
11 | import gc |
|
12 | import gc | |
12 | import itertools |
|
13 | import itertools | |
|
14 | import math | |||
13 | import os |
|
15 | import os | |
|
16 | import pstats | |||
|
17 | import re | |||
14 | import shlex |
|
18 | import shlex | |
15 | import sys |
|
19 | import sys | |
16 | import time |
|
20 | import time | |
17 | import timeit |
|
21 | import timeit | |
18 | import math |
|
22 | from ast import Module | |
19 | import re |
|
23 | from io import StringIO | |
|
24 | from logging import error | |||
|
25 | from pathlib import Path | |||
20 | from pdb import Restart |
|
26 | from pdb import Restart | |
|
27 | from warnings import warn | |||
21 |
|
28 | |||
22 | import cProfile as profile |
|
29 | from IPython.core import magic_arguments, oinspect, page | |
23 | import pstats |
|
|||
24 |
|
||||
25 | from IPython.core import oinspect |
|
|||
26 | from IPython.core import magic_arguments |
|
|||
27 | from IPython.core import page |
|
|||
28 | from IPython.core.error import UsageError |
|
30 | from IPython.core.error import UsageError | |
29 | from IPython.core.macro import Macro |
|
31 | from IPython.core.macro import Macro | |
30 | from IPython.core.magic import (Magics, magics_class, line_magic, cell_magic, |
|
32 | from IPython.core.magic import ( | |
31 | line_cell_magic, on_off, needs_local_scope, |
|
33 | Magics, | |
32 | no_var_expand) |
|
34 | cell_magic, | |
|
35 | line_cell_magic, | |||
|
36 | line_magic, | |||
|
37 | magics_class, | |||
|
38 | needs_local_scope, | |||
|
39 | no_var_expand, | |||
|
40 | on_off, | |||
|
41 | ) | |||
33 | from IPython.testing.skipdoctest import skip_doctest |
|
42 | from IPython.testing.skipdoctest import skip_doctest | |
34 | from IPython.utils.contexts import preserve_keys |
|
|||
35 | from IPython.utils.capture import capture_output |
|
43 | from IPython.utils.capture import capture_output | |
|
44 | from IPython.utils.contexts import preserve_keys | |||
36 | from IPython.utils.ipstruct import Struct |
|
45 | from IPython.utils.ipstruct import Struct | |
37 | from IPython.utils.module_paths import find_mod |
|
46 | from IPython.utils.module_paths import find_mod | |
38 | from IPython.utils.path import get_py_filename, shellglob |
|
47 | from IPython.utils.path import get_py_filename, shellglob | |
39 | from IPython.utils.timing import clock, clock2 |
|
48 | from IPython.utils.timing import clock, clock2 | |
40 | from warnings import warn |
|
|||
41 | from logging import error |
|
|||
42 | from pathlib import Path |
|
|||
43 | from io import StringIO |
|
|||
44 | from pathlib import Path |
|
|||
45 |
|
||||
46 | if sys.version_info > (3,8): |
|
|||
47 | from ast import Module |
|
|||
48 | else : |
|
|||
49 | # mock the new API, ignore second argument |
|
|||
50 | # see https://github.com/ipython/ipython/issues/11590 |
|
|||
51 | from ast import Module as OriginalModule |
|
|||
52 | Module = lambda nodelist, type_ignores: OriginalModule(nodelist) |
|
|||
53 |
|
||||
54 |
|
49 | |||
55 | #----------------------------------------------------------------------------- |
|
50 | #----------------------------------------------------------------------------- | |
56 | # Magic implementation classes |
|
51 | # Magic implementation classes |
@@ -1308,12 +1308,7 b' def test_time_no_var_expand():' | |||||
1308 | # this is slow, put at the end for local testing. |
|
1308 | # this is slow, put at the end for local testing. | |
1309 | def test_timeit_arguments(): |
|
1309 | def test_timeit_arguments(): | |
1310 | "Test valid timeit arguments, should not cause SyntaxError (GH #1269)" |
|
1310 | "Test valid timeit arguments, should not cause SyntaxError (GH #1269)" | |
1311 | if sys.version_info < (3,7): |
|
1311 | _ip.magic("timeit -n1 -r1 a=('#')") | |
1312 | _ip.magic("timeit -n1 -r1 ('#')") |
|
|||
1313 | else: |
|
|||
1314 | # 3.7 optimize no-op statement like above out, and complain there is |
|
|||
1315 | # nothing in the for loop. |
|
|||
1316 | _ip.magic("timeit -n1 -r1 a=('#')") |
|
|||
1317 |
|
1312 | |||
1318 |
|
1313 | |||
1319 | TEST_MODULE = """ |
|
1314 | TEST_MODULE = """ |
General Comments 0
You need to be logged in to leave comments.
Login now