summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-03-18 15:41:51 (GMT)
committerGuido van Rossum <guido@python.org>2007-03-18 15:41:51 (GMT)
commit52cc1d838f4fee573e57b5b182d8e5f5db63240f (patch)
tree0ea50468d2b04ee12131c155c5918e8a70dafe1c /Include
parentef17c16b366b09a78dfe5fc5171fe2b0b29f60e5 (diff)
downloadcpython-52cc1d838f4fee573e57b5b182d8e5f5db63240f.zip
cpython-52cc1d838f4fee573e57b5b182d8e5f5db63240f.tar.gz
cpython-52cc1d838f4fee573e57b5b182d8e5f5db63240f.tar.bz2
Implement PEP 3115 -- new metaclass syntax and semantics.
The compiler package hasn't been updated yet; test_compiler.py fails. Otherwise all tests seem to be passing now. There are no occurrences of __metaclass__ left in the standard library. Docs have not been updated.
Diffstat (limited to 'Include')
-rw-r--r--Include/Python-ast.h8
-rw-r--r--Include/opcode.h10
2 files changed, 11 insertions, 7 deletions
diff --git a/Include/Python-ast.h b/Include/Python-ast.h
index 233a576..e07f025 100644
--- a/Include/Python-ast.h
+++ b/Include/Python-ast.h
@@ -82,6 +82,9 @@ struct _stmt {
struct {
identifier name;
asdl_seq *bases;
+ asdl_seq *keywords;
+ expr_ty starargs;
+ expr_ty kwargs;
asdl_seq *body;
} ClassDef;
@@ -380,8 +383,9 @@ mod_ty _Py_Suite(asdl_seq * body, PyArena *arena);
stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
asdl_seq * decorators, expr_ty returns, int lineno, int
col_offset, PyArena *arena);
-#define ClassDef(a0, a1, a2, a3, a4, a5) _Py_ClassDef(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int
+#define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8)
+stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords,
+ expr_ty starargs, expr_ty kwargs, asdl_seq * body, int
lineno, int col_offset, PyArena *arena);
#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3)
stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
diff --git a/Include/opcode.h b/Include/opcode.h
index 316ba4f..662fbb4 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -59,8 +59,9 @@ extern "C" {
#define BINARY_OR 66
#define INPLACE_POWER 67
#define GET_ITER 68
-
+#define STORE_LOCALS 69
#define PRINT_EXPR 70
+#define LOAD_BUILD_CLASS 71
#define INPLACE_LSHIFT 75
#define INPLACE_RSHIFT 76
@@ -69,14 +70,13 @@ extern "C" {
#define INPLACE_OR 79
#define BREAK_LOOP 80
#define WITH_CLEANUP 81
-#define LOAD_LOCALS 82
+
#define RETURN_VALUE 83
#define IMPORT_STAR 84
#define MAKE_BYTES 85
#define YIELD_VALUE 86
#define POP_BLOCK 87
#define END_FINALLY 88
-#define BUILD_CLASS 89
#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */
@@ -120,10 +120,10 @@ extern "C" {
#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */
/* CALL_FUNCTION_XXX opcodes defined below depend on this definition */
#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */
-#define MAKE_FUNCTION 132 /* #defaults */
+#define MAKE_FUNCTION 132 /* #defaults + #kwdefaults<<8 + #annotations<<16 */
#define BUILD_SLICE 133 /* Number of items */
-#define MAKE_CLOSURE 134 /* #free vars */
+#define MAKE_CLOSURE 134 /* same as MAKE_FUNCTION */
#define LOAD_CLOSURE 135 /* Load free variable from closure */
#define LOAD_DEREF 136 /* Load and dereference from closure cell */
#define STORE_DEREF 137 /* Store into cell */