summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-07-18 14:21:06 (GMT)
committerGuido van Rossum <guido@python.org>1995-07-18 14:21:06 (GMT)
commit884afd654a79bcb836afcdb5c953a627fd45c4c7 (patch)
treeeb0d6c872c09cad854aa168829d9feda2a4df4ea
parente15dee5e3cf863657f47974cb51721ef3cca2ff8 (diff)
downloadcpython-884afd654a79bcb836afcdb5c953a627fd45c4c7.zip
cpython-884afd654a79bcb836afcdb5c953a627fd45c4c7.tar.gz
cpython-884afd654a79bcb836afcdb5c953a627fd45c4c7.tar.bz2
keyword arguments and faster function calls
-rw-r--r--Include/ceval.h2
-rw-r--r--Include/compile.h37
-rw-r--r--Include/eval.h3
-rw-r--r--Include/frameobject.h1
-rw-r--r--Include/funcobject.h9
-rw-r--r--Include/object.h2
-rw-r--r--Include/opcode.h10
-rw-r--r--Include/patchlevel.h2
-rw-r--r--Include/traceback.h4
9 files changed, 38 insertions, 32 deletions
diff --git a/Include/ceval.h b/Include/ceval.h
index 474e386..70abbb4 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -31,6 +31,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Interface to random parts in ceval.c */
PyObject *PyEval_CallObject Py_PROTO((PyObject *, PyObject *));
+PyObject *PyEval_CallObjectWithKeywords
+ Py_PROTO((PyObject *, PyObject *, PyObject *));
PyObject *PyEval_GetBuiltins Py_PROTO((void));
PyObject *PyEval_GetGlobals Py_PROTO((void));
diff --git a/Include/compile.h b/Include/compile.h
index f311a4b..02d11dd 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -28,25 +28,29 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
-/* Definitions for compiled intermediate code */
-
-
-/* An intermediate code fragment contains:
- - a string that encodes the instructions,
- - a list of the constants,
- - a list of the names used,
- - the filename from which it was compiled,
- - the name of the object for which it was compiled. */
+/* Definitions for bytecode */
+/* Bytecode object */
typedef struct {
PyObject_HEAD
- PyStringObject *co_code; /* instruction opcodes */
- PyObject *co_consts; /* list of immutable constant objects */
- PyObject *co_names; /* list of stringobjects */
- PyObject *co_filename; /* string */
- PyObject *co_name; /* string */
+ int co_argcount; /* #arguments, except *args */
+ int co_nlocals; /* #local variables */
+ int co_flags; /* CO_..., see below */
+ PyStringObject *co_code; /* instruction opcodes */
+ PyObject *co_consts; /* list (constants used) */
+ PyObject *co_names; /* list of strings (names used) */
+ PyObject *co_varnames; /* tuple of strings (local variable names) */
+ /* The rest doesn't count for hash/cmp */
+ PyObject *co_filename; /* string (where it was loaded from) */
+ PyObject *co_name; /* string (name, for reference) */
} PyCodeObject;
+/* Masks for co_flags above */
+#define CO_OPTIMIZED 0x0001
+#define CO_NEWLOCALS 0x0002
+#define CO_VARARGS 0x0004
+#define CO_VARKEYWORDS 0x0008
+
extern DL_IMPORT(PyTypeObject) PyCode_Type;
#define PyCode_Check(op) ((op)->ob_type == &PyCode_Type)
@@ -55,8 +59,9 @@ extern DL_IMPORT(PyTypeObject) PyCode_Type;
/* Public interface */
struct _node; /* Declare the existence of this type */
PyCodeObject *PyNode_Compile Py_PROTO((struct _node *, char *));
-PyCodeObject *PyCode_New
- Py_PROTO((PyObject *, PyObject *, PyObject *, PyObject *, PyObject *));
+PyCodeObject *PyCode_New Py_PROTO((
+ int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
+ PyObject *, PyObject *)); /* same as struct above */
#ifdef __cplusplus
}
diff --git a/Include/eval.h b/Include/eval.h
index f374826..56f9938 100644
--- a/Include/eval.h
+++ b/Include/eval.h
@@ -30,8 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Interface to execute compiled code */
-PyObject *PyEval_EvalCode
- Py_PROTO((PyCodeObject *, PyObject *, PyObject *, PyObject *, PyObject *));
+PyObject *PyEval_EvalCode Py_PROTO((PyCodeObject *, PyObject *, PyObject *));
#ifdef __cplusplus
}
diff --git a/Include/frameobject.h b/Include/frameobject.h
index e0c94e0..a38a85d 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -45,7 +45,6 @@ typedef struct _frame {
PyObject *f_locals; /* local symbol table (PyDictObject) */
PyObject *f_owner; /* owner (e.g. class or module) or NULL */
PyObject *f_fastlocals; /* fast local variables (PyListObject) */
- PyObject *f_localmap; /* local variable names (PyDictObject) */
PyObject **f_valuestack; /* malloc'ed array */
PyTryBlock *f_blockstack; /* malloc'ed array */
int f_nvalues; /* size of f_valuestack */
diff --git a/Include/funcobject.h b/Include/funcobject.h
index f618363..2ab4698 100644
--- a/Include/funcobject.h
+++ b/Include/funcobject.h
@@ -34,10 +34,9 @@ typedef struct {
PyObject_HEAD
PyObject *func_code;
PyObject *func_globals;
- PyObject *func_name;
- int func_argcount;
- PyObject *func_argdefs;
+ PyObject *func_defaults;
PyObject *func_doc;
+ PyObject *func_name;
} PyFunctionObject;
extern DL_IMPORT(PyTypeObject) PyFunction_Type;
@@ -47,8 +46,8 @@ extern DL_IMPORT(PyTypeObject) PyFunction_Type;
extern PyObject *PyFunction_New Py_PROTO((PyObject *, PyObject *));
extern PyObject *PyFunction_GetCode Py_PROTO((PyObject *));
extern PyObject *PyFunction_GetGlobals Py_PROTO((PyObject *));
-extern PyObject *PyFunction_GetArgStuff Py_PROTO((PyObject *, int *));
-extern int PyFunction_SetArgStuff Py_PROTO((PyObject *, int, PyObject *));
+extern PyObject *PyFunction_GetDefaults Py_PROTO((PyObject *));
+extern int PyFunction_SetDefaults Py_PROTO((PyObject *, PyObject *));
#ifdef __cplusplus
}
diff --git a/Include/object.h b/Include/object.h
index d1e60be..55c9722 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -217,7 +217,7 @@ typedef struct _typeobject {
/* More standard operations (at end for binary compatibility) */
hashfunc tp_hash;
- binaryfunc tp_call;
+ ternaryfunc tp_call;
reprfunc tp_str;
/* Space for future expansion */
diff --git a/Include/opcode.h b/Include/opcode.h
index 959bb44..9725580 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -40,7 +40,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define UNARY_NEGATIVE 11
#define UNARY_NOT 12
#define UNARY_CONVERT 13
-#define UNARY_CALL 14
+
#define UNARY_INVERT 15
#define BINARY_MULTIPLY 20
@@ -49,7 +49,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define BINARY_ADD 23
#define BINARY_SUBTRACT 24
#define BINARY_SUBSCR 25
-#define BINARY_CALL 26
#define SLICE 30
/* Also uses 31-33 */
@@ -75,13 +74,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define PRINT_NEWLINE 72
#define BREAK_LOOP 80
-#define RAISE_EXCEPTION 81
+
#define LOAD_LOCALS 82
#define RETURN_VALUE 83
-#define LOAD_GLOBALS 84
+
#define EXEC_STMT 85
-#define BUILD_FUNCTION 86
#define POP_BLOCK 87
#define END_FINALLY 88
#define BUILD_CLASS 89
@@ -125,7 +123,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define SETUP_EXCEPT 121 /* "" */
#define SETUP_FINALLY 122 /* "" */
-#define RESERVE_FAST 123 /* Number of local variables */
#define LOAD_FAST 124 /* Local variable number */
#define STORE_FAST 125 /* Local variable number */
#define DELETE_FAST 126 /* Local variable number */
@@ -139,6 +136,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */
#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */
+#define MAKE_FUNCTION 132 /* #defaults */
/* Comparison operator codes (argument to COMPARE_OP) */
enum cmp_op {LT, LE, EQ, NE, GT, GE, IN, NOT_IN, IS, IS_NOT, EXC_MATCH, BAD};
diff --git a/Include/patchlevel.h b/Include/patchlevel.h
index 4492148..e60c1d8 100644
--- a/Include/patchlevel.h
+++ b/Include/patchlevel.h
@@ -1 +1 @@
-#define PATCHLEVEL "1.2"
+#define PATCHLEVEL "1.3b1"
diff --git a/Include/traceback.h b/Include/traceback.h
index c04f515..ad37dd9 100644
--- a/Include/traceback.h
+++ b/Include/traceback.h
@@ -37,6 +37,10 @@ PyObject *PyTraceBack_Fetch Py_PROTO((void));
int PyTraceBack_Store Py_PROTO((PyObject *));
int PyTraceBack_Print Py_PROTO((PyObject *, PyObject *));
+/* Reveale traceback type so we can typecheck traceback objects */
+extern PyTypeObject PyTraceback_Type;
+#define PyTraceback_Check(v) ((v)->ob_type == &PyTraceback_Type)
+
#ifdef __cplusplus
}
#endif