]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
keyword arguments and faster function calls
authorGuido van Rossum <guido@python.org>
Tue, 18 Jul 1995 14:21:06 +0000 (14:21 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 18 Jul 1995 14:21:06 +0000 (14:21 +0000)
Include/ceval.h
Include/compile.h
Include/eval.h
Include/frameobject.h
Include/funcobject.h
Include/object.h
Include/opcode.h
Include/patchlevel.h
Include/traceback.h

index 474e386608694f90679db97d5a596e7c4a19a3a3..70abbb4c28a7b16c8a801d8b917b69611cea20d6 100644 (file)
@@ -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));
index f311a4ba20d43fb525e1b84055f5b3384ef319b1..02d11ddcb82a6b8eab1cd1d806e500e87cf90cfa 100644 (file)
@@ -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
 }
index f37482631ca65bdadc40f6fa6890dd8e4ba68e8d..56f9938df882d1675014db57e9bfe163122862b4 100644 (file)
@@ -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
 }
index e0c94e0861b2c3ed990695f89e720ad8561ba326..a38a85d542a8de9abf1156ff9e3caf36efe4e059 100644 (file)
@@ -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 */
index f618363cf224ac004b0cab750065af94cb7d697a..2ab46980486deb80fa7b18fcf5105f60c1d9bdf1 100644 (file)
@@ -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
 }
index d1e60be700a010657d3792b63cfc0a9b3e7e1bdf..55c972223da93f9ab2252d520d78c562f32e3bf5 100644 (file)
@@ -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 */
index 959bb44883504a1de24d1d8efe99730d69e083ae..972558060c7ef0750487f4fc2a2922ee3b2b9551 100644 (file)
@@ -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};
index 449214871002d646076b3a3696f15cccf9b26f8a..e60c1d881928d477ec4cbfc841b94b281976eded 100644 (file)
@@ -1 +1 @@
-#define PATCHLEVEL "1.2"
+#define PATCHLEVEL "1.3b1"
index c04f515c54614fa4daa5e4f2f189d2a0d274f013..ad37dd9cc84acb3ba4fc49bd5ef73445db308bce 100644 (file)
@@ -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