summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-02-28 19:02:24 (GMT)
committerThomas Wouters <thomas@python.org>2006-02-28 19:02:24 (GMT)
commit34aa7ba11431a46e72ec30ee7528f2e52adbed7f (patch)
treeac399604026430f720f60a7b42264103a747a18c /Include
parentedc8f1366af2d32882649647a7a79873a6cb9503 (diff)
downloadcpython-34aa7ba11431a46e72ec30ee7528f2e52adbed7f.zip
cpython-34aa7ba11431a46e72ec30ee7528f2e52adbed7f.tar.gz
cpython-34aa7ba11431a46e72ec30ee7528f2e52adbed7f.tar.bz2
from __future__ import with_statement addon for 'with', mostly written by
Neal.
Diffstat (limited to 'Include')
-rw-r--r--Include/code.h6
-rw-r--r--Include/compile.h1
-rw-r--r--Include/modsupport.h6
-rw-r--r--Include/parsetok.h2
-rw-r--r--Include/pythonrun.h3
5 files changed, 15 insertions, 3 deletions
diff --git a/Include/code.h b/Include/code.h
index e81b576..9e6cb56 100644
--- a/Include/code.h
+++ b/Include/code.h
@@ -46,6 +46,12 @@ typedef struct {
#endif
#define CO_FUTURE_DIVISION 0x2000
#define CO_FUTURE_ABSIMPORT 0x4000 /* absolute import by default */
+#define CO_FUTURE_WITH_STATEMENT 0x8000
+
+/* This should be defined if a future statement modifies the syntax.
+ For example, when a keyword is added.
+*/
+#define PY_PARSER_REQUIRES_FUTURE_KEYWORD
#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */
diff --git a/Include/compile.h b/Include/compile.h
index 66b445e..01ba25c 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -23,6 +23,7 @@ typedef struct {
#define FUTURE_GENERATORS "generators"
#define FUTURE_DIVISION "division"
#define FUTURE_ABSIMPORT "absolute_import"
+#define FUTURE_WITH_STATEMENT "with_statement"
struct _mod; /* Declare the existence of this type */
PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *,
diff --git a/Include/modsupport.h b/Include/modsupport.h
index a56d07c..c31c5be 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -39,8 +39,8 @@ PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
-#define PYTHON_API_VERSION 1012
-#define PYTHON_API_STRING "1012"
+#define PYTHON_API_VERSION 1013
+#define PYTHON_API_STRING "1013"
/* The API version is maintained (independently from the Python version)
so we can detect mismatches between the interpreter and dynamically
loaded modules. These are diagnosed by an error message but
@@ -54,6 +54,8 @@ PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char
Please add a line or two to the top of this log for each API
version change:
+ 22-Feb-2006 GvR 1013 PEP 353 - long indices for sequence lengths
+
19-Aug-2002 GvR 1012 Changes to string object struct for
interning changes, saving 3 bytes.
diff --git a/Include/parsetok.h b/Include/parsetok.h
index b788566..0f87e81 100644
--- a/Include/parsetok.h
+++ b/Include/parsetok.h
@@ -23,6 +23,8 @@ typedef struct {
#define PyPARSE_DONT_IMPLY_DEDENT 0x0002
+#define PyPARSE_WITH_IS_KEYWORD 0x0003
+
PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
perrdetail *);
PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 5949d5b..feb79ae 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -7,7 +7,8 @@
extern "C" {
#endif
-#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSIMPORT)
+#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSIMPORT | \
+ CO_FUTURE_WITH_STATEMENT)
#define PyCF_MASK_OBSOLETE (CO_NESTED)
#define PyCF_SOURCE_IS_UTF8 0x0100
#define PyCF_DONT_IMPLY_DEDENT 0x0200