[Python-checkins] CVS: python/dist/src/Include opcode.h,2.21,2.22

Jeremy Hylton python-dev@python.org
Tue, 28 Mar 2000 18:49:06 -0500


Update of /projects/cvsroot/python/dist/src/Include
In directory goon.cnri.reston.va.us:/home/jhylton/python/src/Include

Modified Files:
	opcode.h 
Log Message:
slightly modified version of Greg Ewing's extended call syntax patch

executive summary:
Instead of typing 'apply(f, args, kwargs)' you can type 'f(*arg, **kwargs)'.
Some file-by-file details follow.

Grammar/Grammar:
    simplify varargslist, replacing '*' '*' with '**'
    add * & ** options to arglist

Include/opcode.h & Lib/dis.py:
    define three new opcodes
        CALL_FUNCTION_VAR
        CALL_FUNCTION_KW
        CALL_FUNCTION_VAR_KW

Python/ceval.c:
    extend TypeError "keyword parameter redefined" message to include
        the name of the offending keyword 
    reindent CALL_FUNCTION using four spaces
    add handling of sequences and dictionaries using extend calls
    fix function import_from to use PyErr_Format


Index: opcode.h
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Include/opcode.h,v
retrieving revision 2.21
retrieving revision 2.22
diff -C2 -r2.21 -r2.22
*** opcode.h	1998/07/07 14:58:39	2.21
--- opcode.h	2000/03/28 23:49:04	2.22
***************
*** 139,145 ****
--- 139,152 ----
  
  #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 BUILD_SLICE 	133	/* Number of items */
+ 
+ /* The next 3 opcodes must be contiguous and satisfy
+    (CALL_FUNCTION_STAR - CALL_FUNCTION) & 3 == 1  */
+ #define CALL_FUNCTION_VAR          140	/* #args + (#kwargs<<8) */
+ #define CALL_FUNCTION_KW           141	/* #args + (#kwargs<<8) */
+ #define CALL_FUNCTION_VAR_KW       142	/* #args + (#kwargs<<8) */
  
  /* Comparison operator codes (argument to COMPARE_OP) */