cpython/Include
Jeremy Hylton 64949cb753 PEP 227 implementation
The majority of the changes are in the compiler.  The mainloop changes
primarily to implement the new opcodes and to pass a function's
closure to eval_code2().  Frames and functions got new slots to hold
the closure.

Include/compile.h
    Add co_freevars and co_cellvars slots to code objects.
    Update PyCode_New() to take freevars and cellvars as arguments
Include/funcobject.h
    Add func_closure slot to function objects.
    Add GetClosure()/SetClosure() functions (and corresponding
    macros) for getting at the closure.
Include/frameobject.h
    PyFrame_New() now takes a closure.
Include/opcode.h
    Add four new opcodes: MAKE_CLOSURE, LOAD_CLOSURE, LOAD_DEREF,
    STORE_DEREF.
    Remove comment about old requirement for opcodes to fit in 7
    bits.
compile.c
    Implement changes to code objects for co_freevars and co_cellvars.

    Modify symbol table to use st_cur_name (string object for the name
    of the current scope) and st_cur_children (list of nested blocks).
    Also define st_nested, which might more properly be called
    st_cur_nested.  Add several DEF_XXX flags to track def-use
    information for free variables.

    New or modified functions of note:
    com_make_closure(struct compiling *, PyCodeObject *)
        Emit LOAD_CLOSURE opcodes as needed to pass cells for free
        variables into nested scope.
    com_addop_varname(struct compiling *, int, char *)
        Emits opcodes for LOAD_DEREF and STORE_DEREF.
    get_ref_type(struct compiling *, char *name)
        Return NAME_CLOSURE if ref type is FREE or CELL
    symtable_load_symbols(struct compiling *)
        Decides what variables are cell or free based on def-use info.
        Can now raise SyntaxError if nested scopes are mixed with
        exec or from blah import *.
    make_scope_info(PyObject *, PyObject *, int, int)
        Helper functions for symtable scope stack.
    symtable_update_free_vars(struct symtable *)
        After a code block has been analyzed, it must check each of
        its children for free variables that are not defined in the
        block.  If a variable is free in a child and not defined in
        the parent, then it is defined by block the enclosing the
        current one or it is a global.  This does the right logic.
    symtable_add_use() is now a macro for symtable_add_def()
    symtable_assign(struct symtable *, node *)
        Use goto instead of for (;;)

    Fixed bug in symtable where name of keyword argument in function
    call was treated as assignment in the scope of the call site. Ex:
        def f():
            g(a=2) # a was considered a local of f

ceval.c
    eval_code2() now take one more argument, a closure.
    Implement LOAD_CLOSURE, LOAD_DEREF, STORE_DEREF, MAKE_CLOSURE>

    Also: When name error occurs for global variable, report that the
    name was global in the error mesage.

Objects/frameobject.c
    Initialize f_closure to be a tuple containing space for cellvars
    and freevars.  f_closure is NULL if neither are present.
Objects/funcobject.c
    Add support for func_closure.
Python/import.c
    Change the magic number.
Python/marshal.c
    Track changes to code objects.
2001-01-25 20:06:59 +00:00
..
Makefile
Python.h PEP 227 implementation 2001-01-25 20:04:14 +00:00
abstract.h This patch adds a new builtin unistr() which behaves like str() 2001-01-17 17:09:53 +00:00
bitset.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
bufferobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
cStringIO.h Miscelaneous ANSIfications. I'm assuming here 'main' should take (int, 2000-07-22 19:25:51 +00:00
cellobject.h PEP 227 implementation 2001-01-25 20:04:14 +00:00
ceval.h RET_SAVE references should be Py_BLOCK_THREADS references 2000-09-15 18:19:27 +00:00
classobject.h Remove PyInstance_*BinOp functions. 2001-01-04 01:30:34 +00:00
cobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
codecs.h Changing the CNRI copyright notice according to CNRI's instructions. 2000-08-03 16:24:25 +00:00
compile.h PEP 227 implementation 2001-01-25 20:06:59 +00:00
complexobject.h ANSI-fication and Py_PROTO extermination. 2000-07-09 00:20:36 +00:00
config.h
dictobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
errcode.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
eval.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
fileobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
floatobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
frameobject.h PEP 227 implementation 2001-01-25 20:06:59 +00:00
funcobject.h PEP 227 implementation 2001-01-25 20:06:59 +00:00
graminit.h The real suport for augmented assignment: new opcodes, new PyNumber and 2000-08-24 20:09:45 +00:00
grammar.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
import.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
intobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
intrcheck.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
listobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
longintrepr.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
longobject.h Rationalize use of limits.h, moving the inclusion to Python.h. 2000-09-26 05:46:01 +00:00
marshal.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
metagrammar.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
methodobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
modsupport.h Andrew Kuchling <akuchlin@mems-exchange.org>: 2000-09-23 03:24:27 +00:00
moduleobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
node.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
object.h Add a flag to indicate the presence of the tp_richcompare field, and 2001-01-24 22:13:48 +00:00
objimpl.h PyGC_Dump() -> _PyGC_Dump() 2001-01-24 04:17:26 +00:00
opcode.h PEP 227 implementation 2001-01-25 20:06:59 +00:00
osdefs.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
parsetok.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
patchlevel.h Bump version to 2.1a1. (To be released Friday.) 2001-01-17 14:12:33 +00:00
pgenheaders.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
py_curses.h Added header file for C API exported by _cursesmodule.c 2000-12-22 21:51:10 +00:00
pydebug.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
pyerrors.h Add declarations for standard warning category classes (PyExc_Warning 2000-12-15 21:57:34 +00:00
pyfpe.h
pygetopt.h Move our own getopt() implementation to _PyOS_GetOpt(), and use it 2000-11-03 08:18:37 +00:00
pymem.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
pyport.h Remove include-file-dependant half-prototype of clnt_create(). 2001-01-22 16:50:11 +00:00
pystate.h Add a new API, PyThreadState_DeleteCurrent() that combines 2001-01-23 01:46:06 +00:00
pythonrun.h Use suggested workaround for PyOS_CheckStack causing failure of test_[s]re.py 2000-10-11 17:18:11 +00:00
pythread.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
rangeobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
rename1.h
sliceobject.h ANSI-fication and Py_PROTO extermination. 2000-07-09 00:55:06 +00:00
stringobject.h Derived from Martin's SF patch 110609: support unbounded ints in %d,i,u,x,X,o formats. 2000-09-21 05:43:11 +00:00
structmember.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
sysmodule.h Add declarations for PySys_ResetWarnOptions() and 2000-12-15 22:01:39 +00:00
token.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
traceback.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
tupleobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
ucnhash.h refactored the unicodeobject/ucnhash interface, to hide the 2001-01-19 09:45:02 +00:00
unicodeobject.h Added #fndef's to avoid compiler errors. 2000-08-11 11:43:10 +00:00