]> granicus.if.org Git - python/commitdiff
Merged revisions 73782-73784 via svnmerge from
authorBenjamin Peterson <benjamin@python.org>
Thu, 2 Jul 2009 22:02:15 +0000 (22:02 +0000)
committerBenjamin Peterson <benjamin@python.org>
Thu, 2 Jul 2009 22:02:15 +0000 (22:02 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r73782 | benjamin.peterson | 2009-07-02 16:44:01 -0500 (Thu, 02 Jul 2009) | 1 line

  the old CO_FUTURE flags can't be commented out
................
  r73783 | benjamin.peterson | 2009-07-02 16:54:36 -0500 (Thu, 02 Jul 2009) | 1 line

  a little more fiddling to make flags like 2.x
................
  r73784 | benjamin.peterson | 2009-07-02 16:55:39 -0500 (Thu, 02 Jul 2009) | 9 lines

  Merged revisions 73781 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r73781 | benjamin.peterson | 2009-07-02 16:38:36 -0500 (Thu, 02 Jul 2009) | 1 line

    test that compile() accepts the future flag
  ........
................

Include/code.h
Include/pythonrun.h
Lib/test/test___future__.py
Misc/NEWS

index 145a9a128b99a424b737effc9ef6363a6ad3a1ba..efaf3c415b72fdf65aee04319c60c00ae139df6e 100644 (file)
@@ -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
 
index 86d9fe2250c05879649a61213d1e37d64839a408..09d3ee55302592f1ffebc52ea3d2f83ccec603e3 100644 (file)
@@ -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
index 77006e1abcfabb3a96232c483d2c5072b12fcfc3..9d98746f9f193d8818106e840ecc09c70fb01882 100644 (file)
@@ -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)
 
index 125a5f0dfb94c84bc99d3885e8f9d3f6c4b76e4b..b08ba8fe72fd5a07500cf94eed78c0a243f5cec4 100644 (file)
--- 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
 -------