mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
Need to support single_input explicitly so from __future__ imports
are legal at the interactive interpreter prompt. They don't do anything yet...
This commit is contained in:
parent
39e2f3f824
commit
280c81a940
1 changed files with 8 additions and 0 deletions
|
|
@ -71,6 +71,13 @@ future_parse(PyFutureFeatures *ff, node *n, char *filename)
|
||||||
|
|
||||||
switch (TYPE(n)) {
|
switch (TYPE(n)) {
|
||||||
|
|
||||||
|
case single_input:
|
||||||
|
if (TYPE(CHILD(n, 0)) == simple_stmt) {
|
||||||
|
n = CHILD(n, 0);
|
||||||
|
goto loop;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
case file_input:
|
case file_input:
|
||||||
for (i = 0; i < NCH(n); i++) {
|
for (i = 0; i < NCH(n); i++) {
|
||||||
node *ch = CHILD(n, i);
|
node *ch = CHILD(n, i);
|
||||||
|
|
@ -157,6 +164,7 @@ future_parse(PyFutureFeatures *ff, node *n, char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
if (future_check_features(ff, n) < 0)
|
if (future_check_features(ff, n) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
ff->ff_last_lineno = n->n_lineno + 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue