+++ /dev/null
-"""Record of phased-in incompatible language changes.\r
-\r
-Each line is of the form:\r
-\r
- FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease ","\r
- CompilerFlag ")"\r
-\r
-where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples\r
-of the same form as sys.version_info:\r
-\r
- (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int\r
- PY_MINOR_VERSION, # the 1; an int\r
- PY_MICRO_VERSION, # the 0; an int\r
- PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string\r
- PY_RELEASE_SERIAL # the 3; an int\r
- )\r
-\r
-OptionalRelease records the first release in which\r
-\r
- from __future__ import FeatureName\r
-\r
-was accepted.\r
-\r
-In the case of MandatoryReleases that have not yet occurred,\r
-MandatoryRelease predicts the release in which the feature will become part\r
-of the language.\r
-\r
-Else MandatoryRelease records when the feature became part of the language;\r
-in releases at or after that, modules no longer need\r
-\r
- from __future__ import FeatureName\r
-\r
-to use the feature in question, but may continue to use such imports.\r
-\r
-MandatoryRelease may also be None, meaning that a planned feature got\r
-dropped.\r
-\r
-Instances of class _Feature have two corresponding methods,\r
-.getOptionalRelease() and .getMandatoryRelease().\r
-\r
-CompilerFlag is the (bitfield) flag that should be passed in the fourth\r
-argument to the builtin function compile() to enable the feature in\r
-dynamically compiled code. This flag is stored in the .compiler_flag\r
-attribute on _Future instances. These values must match the appropriate\r
-#defines of CO_xxx flags in Include/compile.h.\r
-\r
-No feature line is ever to be deleted from this file.\r
-"""\r
-\r
-all_feature_names = [\r
- "nested_scopes",\r
- "generators",\r
- "division",\r
- "absolute_import",\r
- "with_statement",\r
- "print_function",\r
- "unicode_literals",\r
-]\r
-\r
-__all__ = ["all_feature_names"] + all_feature_names\r
-\r
-# The CO_xxx symbols are defined here under the same names used by\r
-# compile.h, so that an editor search will find them here. However,\r
-# they're not exported in __all__, because they don't really belong to\r
-# this module.\r
-CO_NESTED = 0x0010 # nested_scopes\r
-CO_GENERATOR_ALLOWED = 0 # generators (obsolete, was 0x1000)\r
-CO_FUTURE_DIVISION = 0x2000 # division\r
-CO_FUTURE_ABSOLUTE_IMPORT = 0x4000 # perform absolute imports by default\r
-CO_FUTURE_WITH_STATEMENT = 0x8000 # with statement\r
-CO_FUTURE_PRINT_FUNCTION = 0x10000 # print function\r
-CO_FUTURE_UNICODE_LITERALS = 0x20000 # unicode string literals\r
-\r
-class _Feature:\r
- def __init__(self, optionalRelease, mandatoryRelease, compiler_flag):\r
- self.optional = optionalRelease\r
- self.mandatory = mandatoryRelease\r
- self.compiler_flag = compiler_flag\r
-\r
- def getOptionalRelease(self):\r
- """Return first release in which this feature was recognized.\r
-\r
- This is a 5-tuple, of the same form as sys.version_info.\r
- """\r
-\r
- return self.optional\r
-\r
- def getMandatoryRelease(self):\r
- """Return release in which this feature will become mandatory.\r
-\r
- This is a 5-tuple, of the same form as sys.version_info, or, if\r
- the feature was dropped, is None.\r
- """\r
-\r
- return self.mandatory\r
-\r
- def __repr__(self):\r
- return "_Feature" + repr((self.optional,\r
- self.mandatory,\r
- self.compiler_flag))\r
-\r
-nested_scopes = _Feature((2, 1, 0, "beta", 1),\r
- (2, 2, 0, "alpha", 0),\r
- CO_NESTED)\r
-\r
-generators = _Feature((2, 2, 0, "alpha", 1),\r
- (2, 3, 0, "final", 0),\r
- CO_GENERATOR_ALLOWED)\r
-\r
-division = _Feature((2, 2, 0, "alpha", 2),\r
- (3, 0, 0, "alpha", 0),\r
- CO_FUTURE_DIVISION)\r
-\r
-absolute_import = _Feature((2, 5, 0, "alpha", 1),\r
- (2, 7, 0, "alpha", 0),\r
- CO_FUTURE_ABSOLUTE_IMPORT)\r
-\r
-with_statement = _Feature((2, 5, 0, "alpha", 1),\r
- (2, 6, 0, "alpha", 0),\r
- CO_FUTURE_WITH_STATEMENT)\r
-\r
-print_function = _Feature((2, 6, 0, "alpha", 2),\r
- (3, 0, 0, "alpha", 0),\r
- CO_FUTURE_PRINT_FUNCTION)\r
-\r
-unicode_literals = _Feature((2, 6, 0, "alpha", 2),\r
- (3, 0, 0, "alpha", 0),\r
- CO_FUTURE_UNICODE_LITERALS)\r