mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
A self-contained piece of Michael Hudson's patch
#449043 supporting __future__ in simulated shells in support of PEP 264. Much has changed from the patch version: + Repaired bad hex constant for nested_scopes. + Defined symbolic CO_xxx names so global search will find these uses. + Made the exported list of feature names explicit, instead of abusing __all__ for this purpose (and redefined __all__ accordingly). + Added gross .compiler_flag verification to test___future__.py, and reworked it a little to make use of the newly exported explicit list of feature names.
This commit is contained in:
parent
b0a98e9c94
commit
de642bdc5d
2 changed files with 46 additions and 8 deletions
|
|
@ -5,7 +5,7 @@ import __future__
|
|||
|
||||
GOOD_SERIALS = ("alpha", "beta", "candidate", "final")
|
||||
|
||||
features = [x for x in dir(__future__) if x[:1] != "_"]
|
||||
features = __future__.all_feature_names
|
||||
for feature in features:
|
||||
value = getattr(__future__, feature)
|
||||
if verbose:
|
||||
|
|
@ -39,3 +39,8 @@ for feature in features:
|
|||
verify(type(serial) is IntType, "mandatory serial isn't int")
|
||||
verify(optional < mandatory,
|
||||
"optional not less than mandatory, and mandatory not None")
|
||||
|
||||
verify(hasattr(value, "compiler_flag"),
|
||||
"feature is missing a .compiler_flag attr")
|
||||
verify(type(getattr(value, "compiler_flag")) is IntType,
|
||||
".compiler_flag isn't int")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue