diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-08-18 20:18:49 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-08-18 20:18:49 (GMT) |
commit | aa32070f4d7b7151974e70b407b0f0dc2a836313 (patch) | |
tree | 20ea4d8e13d5dfa5f861f37be3963cd2a1874dd2 /Lib/__future__.py | |
parent | 95618b5bc98ca9f30ed9dd2e4382fd737bbbbc6c (diff) | |
download | cpython-aa32070f4d7b7151974e70b407b0f0dc2a836313.zip cpython-aa32070f4d7b7151974e70b407b0f0dc2a836313.tar.gz cpython-aa32070f4d7b7151974e70b407b0f0dc2a836313.tar.bz2 |
Expose the CO_xxx flags via the "new" module (re-solving a problem "the
right way"). Fiddle __future__.py to use them.
Jeremy's pyassem.py may also want to use them (by-hand duplication of
magic numbers is brittle), but leaving that to his judgment.
Beef up __future__'s test to verify the exported feature names appear
correct.
Diffstat (limited to 'Lib/__future__.py')
-rw-r--r-- | Lib/__future__.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/Lib/__future__.py b/Lib/__future__.py index ef9fd36..5a64838 100644 --- a/Lib/__future__.py +++ b/Lib/__future__.py @@ -55,14 +55,7 @@ all_feature_names = [ __all__ = ["all_feature_names"] + all_feature_names - -# The CO_xxx symbols are defined here under the same names used by -# compile.h, so that an editor search will find them here. However, -# they're not exported in __all__, because they don't really belong to -# this module. -CO_NESTED = 0x0010 # nested_scopes -CO_GENERATOR_ALLOWED = 0x1000 # generators -CO_FUTURE_DIVISION = 0x2000 # division +import new as _new # for CO_xxx symbols class _Feature: def __init__(self, optionalRelease, mandatoryRelease, compiler_flag): @@ -93,12 +86,12 @@ class _Feature: nested_scopes = _Feature((2, 1, 0, "beta", 1), (2, 2, 0, "alpha", 0), - CO_NESTED) + _new.CO_NESTED) generators = _Feature((2, 2, 0, "alpha", 1), (2, 3, 0, "final", 0), - CO_GENERATOR_ALLOWED) + _new.CO_GENERATOR_ALLOWED) division = _Feature((2, 2, 0, "alpha", 2), (3, 0, 0, "alpha", 0), - CO_FUTURE_DIVISION) + _new.CO_FUTURE_DIVISION) |