diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-10 21:41:33 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-10 21:41:33 (GMT) |
commit | b857ba261fc468d956e350f51469efd7d5773da2 (patch) | |
tree | ae9529e282d8d196eaaab2ab394e395626aca137 /Python/future.c | |
parent | fdd12f66bb9740c7796441cd19db2a9d1502ee4f (diff) | |
download | cpython-b857ba261fc468d956e350f51469efd7d5773da2.zip cpython-b857ba261fc468d956e350f51469efd7d5773da2.tar.gz cpython-b857ba261fc468d956e350f51469efd7d5773da2.tar.bz2 |
Refactor future feature handling
Replace uses of PyCF_xxx with CO_xxx.
Replace individual feature slots in PyFutureFeatures with single
bitmask ff_features.
When flags must be transfered among the three parts of the interpreter
that care about them -- the pythonrun layer, the compiler, and the
future feature parser -- can simply or (|) the definitions.
Diffstat (limited to 'Python/future.c')
-rw-r--r-- | Python/future.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Python/future.c b/Python/future.c index db62b5b..6b1c0c5 100644 --- a/Python/future.c +++ b/Python/future.c @@ -30,11 +30,11 @@ future_check_features(PyFutureFeatures *ff, node *n, char *filename) REQ(ch, import_as_name); feature = STR(CHILD(ch, 0)); if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { - ff->ff_nested_scopes = 1; + continue; } else if (strcmp(feature, FUTURE_GENERATORS) == 0) { - ff->ff_generators = 1; + ff->ff_features |= CO_GENERATOR_ALLOWED; } else if (strcmp(feature, FUTURE_DIVISION) == 0) { - ff->ff_division = 1; + ff->ff_features |= CO_FUTURE_DIVISION; } else if (strcmp(feature, "braces") == 0) { PyErr_SetString(PyExc_SyntaxError, "not a chance"); @@ -234,9 +234,7 @@ PyNode_Future(node *n, char *filename) return NULL; ff->ff_found_docstring = 0; ff->ff_last_lineno = -1; - ff->ff_nested_scopes = 0; - ff->ff_generators = 0; - ff->ff_division = 0; + ff->ff_features = 0; if (future_parse(ff, n, filename) < 0) { PyMem_Free((void *)ff); |