Part way to allowing "from __future__ import generators" to communicate
that info to code dynamically compiled *by* code compiled with generators
enabled.  Doesn't yet work because there's still no way to tell the parser
that "yield" is OK (unlike nested_scopes, the parser has its fingers in
this too).
Replaced PyEval_GetNestedScopes by a more-general
PyEval_MergeCompilerFlags.  Perhaps I should not have?  I doubted it was
*intended* to be part of the public API, so just did.
diff --git a/Include/Python.h b/Include/Python.h
index 5d91125..24d33b2 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -96,8 +96,8 @@
 #include "pystate.h"
 
 #include "modsupport.h"
-#include "ceval.h"
 #include "pythonrun.h"
+#include "ceval.h"
 #include "sysmodule.h"
 #include "intrcheck.h"
 #include "import.h"
diff --git a/Include/ceval.h b/Include/ceval.h
index 19ac064..0fc5cba 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -31,7 +31,11 @@
 DL_IMPORT(PyObject *) PyEval_GetOwner(void);
 DL_IMPORT(PyObject *) PyEval_GetFrame(void);
 DL_IMPORT(int) PyEval_GetRestricted(void);
-DL_IMPORT(int) PyEval_GetNestedScopes(void);
+
+/* Look at the current frame's (if any) code's co_flags, and turn on
+   the corresponding compiler flags in cf->cf_flags.  Return 1 if any
+   flag was set, else return 0. */
+DL_IMPORT(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
 
 DL_IMPORT(int) Py_FlushLine(void);
 
diff --git a/Include/compile.h b/Include/compile.h
index 5e6e572..89c5ba4 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -34,6 +34,13 @@
 #define CO_VARKEYWORDS	0x0008
 #define CO_NESTED       0x0010
 #define CO_GENERATOR    0x0020
+/* XXX Temporary hack.  Until generators are a permanent part of the
+   language, we need a way for a code object to record that generators
+   were *possible* when it was compiled.  This is so code dynamically
+   compiled *by* a code object knows whether to allow yield stmts.  In
+   effect, this passes on the "from __future__ import generators" state
+   in effect when the code block was compiled. */
+#define CO_GENERATOR_ALLOWED    0x1000
 
 extern DL_IMPORT(PyTypeObject) PyCode_Type;
 
@@ -56,6 +63,7 @@
     int ff_found_docstring;
     int ff_last_lineno;
     int ff_nested_scopes;
+    int ff_generators;
 } PyFutureFeatures;
 
 DL_IMPORT(PyFutureFeatures *) PyNode_Future(struct _node *, char *);
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index e7274ec..3877a82 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -7,8 +7,13 @@
 extern "C" {
 #endif
 
+/* These flags are named after the __future__ statements that introduced
+   them.  May not remain true for later additions, so fiddle this comment
+   accordingly then. */
+#define PyCF_NESTED_SCOPES	(0x00000001UL)
+#define PyCF_GENERATORS		(0x00000002UL)
 typedef struct {
-	int cf_nested_scopes;
+	unsigned long cf_flags;  /* bitmask of PyCF_xxx flags */
 } PyCompilerFlags;
 
 DL_IMPORT(void) Py_SetProgramName(char *);