Mercurial > cpython-lru_cache-weakref
diff Python/future.c @ 19158:97a3d3d7029f legacy-trunk
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.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Fri, 10 Aug 2001 21:41:33 +0000 |
| parents | f20727cc3d0f |
| children | 81c7565a56ac |
line wrap: on
line diff
--- a/Python/future.c Fri Aug 10 21:38:04 2001 +0000 +++ b/Python/future.c Fri Aug 10 21:41:33 2001 +0000 @@ -30,11 +30,11 @@ 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 @@ 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);
