summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Include/code.h4
-rw-r--r--Include/pythonrun.h6
-rw-r--r--Lib/test/test___future__.py3
-rw-r--r--Misc/NEWS5
4 files changed, 14 insertions, 4 deletions
diff --git a/Include/code.h b/Include/code.h
index 145a9a1..efaf3c4 100644
--- a/Include/code.h
+++ b/Include/code.h
@@ -42,15 +42,15 @@ typedef struct {
*/
#define CO_NOFREE 0x0040
-#if 0
/* These are no longer used. */
+#if 0
#define CO_GENERATOR_ALLOWED 0x1000
+#endif
#define CO_FUTURE_DIVISION 0x2000
#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */
#define CO_FUTURE_WITH_STATEMENT 0x8000
#define CO_FUTURE_PRINT_FUNCTION 0x10000
#define CO_FUTURE_UNICODE_LITERALS 0x20000
-#endif
#define CO_FUTURE_BARRY_AS_BDFL 0x40000
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 86d9fe2..09d3ee5 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -7,8 +7,10 @@
extern "C" {
#endif
-#define PyCF_MASK CO_FUTURE_BARRY_AS_BDFL
-#define PyCF_MASK_OBSOLETE 0
+#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
+ CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
+ CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL)
+#define PyCF_MASK_OBSOLETE (CO_NESTED)
#define PyCF_SOURCE_IS_UTF8 0x0100
#define PyCF_DONT_IMPLY_DEDENT 0x0200
#define PyCF_ONLY_AST 0x0400
diff --git a/Lib/test/test___future__.py b/Lib/test/test___future__.py
index 77006e1..9d98746 100644
--- a/Lib/test/test___future__.py
+++ b/Lib/test/test___future__.py
@@ -53,9 +53,12 @@ class FutureTest(unittest.TestCase):
a(hasattr(value, "compiler_flag"),
"feature is missing a .compiler_flag attr")
+ # Make sure the compile accepts the flag.
+ compile("", "<test>", "exec", value.compiler_flag)
a(isinstance(getattr(value, "compiler_flag"), int),
".compiler_flag isn't int")
+
def test_main():
support.run_unittest(FutureTest)
diff --git a/Misc/NEWS b/Misc/NEWS
index 125a5f0..b08ba8f 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -20,6 +20,11 @@ Core and Builtins
the 'surrogateescape' error handler, a string which contains unpaired
surrogates.
+C-API
+-----
+
+- The code flags for old __future__ features are now available again.
+
Library
-------