Commit 9f324e9
committed
Useful future statement support for the interactive interpreter
(Also remove warning about module-level global decl, because we can't
distinguish from code passed to exec.)
Define PyCompilerFlags type contains a single element,
cf_nested_scopes, that is true if a nested scopes future statement has
been entered at the interactive prompt.
New API functions:
PyNode_CompileFlags()
PyRun_InteractiveOneFlags()
-- same as their non Flags counterparts except that the take an
optional PyCompilerFlags pointer
compile.c: In jcompile() use PyCompilerFlags argument. If
cf_nested_scopes is true, compile code with nested scopes. If it
is false, but the code has a valid future nested scopes statement,
set it to true.
pythonrun.c: Create a new PyCompilerFlags object in
PyRun_InteractiveLoop() and thread it through to
PyRun_InteractiveOneFlags().1 parent 0f6b383 commit 9f324e9
4 files changed
Lines changed: 59 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
| 475 | + | |
475 | 476 | | |
476 | 477 | | |
477 | 478 | | |
| |||
3816 | 3817 | | |
3817 | 3818 | | |
3818 | 3819 | | |
3819 | | - | |
| 3820 | + | |
| 3821 | + | |
| 3822 | + | |
| 3823 | + | |
| 3824 | + | |
| 3825 | + | |
| 3826 | + | |
3820 | 3827 | | |
3821 | 3828 | | |
3822 | 3829 | | |
| |||
3844 | 3851 | | |
3845 | 3852 | | |
3846 | 3853 | | |
3847 | | - | |
| 3854 | + | |
3848 | 3855 | | |
3849 | 3856 | | |
3850 | 3857 | | |
3851 | | - | |
| 3858 | + | |
| 3859 | + | |
3852 | 3860 | | |
3853 | 3861 | | |
3854 | 3862 | | |
| |||
3864 | 3872 | | |
3865 | 3873 | | |
3866 | 3874 | | |
3867 | | - | |
| 3875 | + | |
| 3876 | + | |
| 3877 | + | |
| 3878 | + | |
| 3879 | + | |
| 3880 | + | |
| 3881 | + | |
| 3882 | + | |
| 3883 | + | |
| 3884 | + | |
| 3885 | + | |
3868 | 3886 | | |
3869 | 3887 | | |
3870 | 3888 | | |
| |||
4952 | 4970 | | |
4953 | 4971 | | |
4954 | 4972 | | |
4955 | | - | |
4956 | | - | |
4957 | | - | |
4958 | | - | |
4959 | | - | |
4960 | | - | |
| 4973 | + | |
| 4974 | + | |
| 4975 | + | |
| 4976 | + | |
4961 | 4977 | | |
4962 | 4978 | | |
4963 | 4979 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
| |||
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | | - | |
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
| |||
472 | 470 | | |
473 | 471 | | |
474 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
475 | 476 | | |
476 | 477 | | |
477 | 478 | | |
| |||
483 | 484 | | |
484 | 485 | | |
485 | 486 | | |
486 | | - | |
| 487 | + | |
487 | 488 | | |
488 | 489 | | |
489 | 490 | | |
| |||
498 | 499 | | |
499 | 500 | | |
500 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
501 | 508 | | |
502 | 509 | | |
503 | 510 | | |
| |||
537 | 544 | | |
538 | 545 | | |
539 | 546 | | |
540 | | - | |
| 547 | + | |
541 | 548 | | |
542 | 549 | | |
543 | 550 | | |
| |||
907 | 914 | | |
908 | 915 | | |
909 | 916 | | |
910 | | - | |
| 917 | + | |
911 | 918 | | |
912 | 919 | | |
913 | 920 | | |
| |||
924 | 931 | | |
925 | 932 | | |
926 | 933 | | |
927 | | - | |
| 934 | + | |
928 | 935 | | |
929 | 936 | | |
930 | 937 | | |
931 | | - | |
| 938 | + | |
| 939 | + | |
932 | 940 | | |
933 | 941 | | |
934 | 942 | | |
935 | | - | |
| 943 | + | |
936 | 944 | | |
937 | 945 | | |
938 | 946 | | |
939 | | - | |
| 947 | + | |
| 948 | + | |
940 | 949 | | |
941 | 950 | | |
942 | 951 | | |
943 | | - | |
| 952 | + | |
| 953 | + | |
944 | 954 | | |
945 | 955 | | |
946 | 956 | | |
| |||
0 commit comments