summaryrefslogtreecommitdiff
path: root/Include/opcode.h
AgeCommit message (Collapse)AuthorLines
2001-02-01Allow 'continue' inside 'try' clauseJeremy Hylton-0/+1
SF patch 102989 by Thomas Wouters
2001-01-25PEP 227 implementationJeremy Hylton-5/+5
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-17Rich comparisons: ensure that LT == Py_LT, etc.Guido van Rossum-1/+2
2000-09-01REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum-9/+0
This should match the situation in the 1.6b1 tree.
2000-08-24The real suport for augmented assignment: new opcodes, new PyNumber andThomas Wouters-3/+13
PySequence methods and functions, new tokens.
2000-08-24Charles G. Waldman <cgw@fnal.gov>:Fred Drake-0/+3
Add the EXTENDED_ARG opcode to the virtual machine, allowing 32-bit arguments to opcodes instead of being forced to stick to the 16-bit limit. This is especially useful for machine-generated code, which can be too long for the SET_LINENO parameter to fit into 16 bits. This closes the implementation portion of SourceForge patch #100893.
2000-08-21PEP 214, Extended print Statement, has been accepted by the BDFL.Barry Warsaw-0/+2
This adds the two new opcodes to support this feature: PRINT_ITEM_TO, PRINT_NEWLINE_TO.
2000-08-17Apply SF patch #101135, adding 'import module as m' and 'from module importThomas Wouters-1/+1
name as n'. By doing some twists and turns, "as" is not a reserved word. There is a slight change in semantics for 'from module import name' (it will now honour the 'global' keyword) but only in cases that are explicitly undocumented.
2000-08-11Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since theyThomas Wouters-2/+2
did the same anyway. I'm not sure what to do with Tools/compiler/compiler/* -- that isn't part of distutils, is it ? Should it try to be compatible with old bytecode version ?
2000-06-30Change copyright notice - 2nd try.Guido van Rossum-6/+0
2000-06-30Change copyright notice.Guido van Rossum-21/+6
2000-03-29remove reference to CALL_FUNCTION_STAR in commentJeremy Hylton-1/+1
2000-03-28slightly modified version of Greg Ewing's extended call syntax patchJeremy Hylton-0/+7
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
1998-07-07Get rid of some obsolete opcodes.Guido van Rossum-5/+0
1997-05-09Get rid of obsolete ACCESS_MODE opcode.Guido van Rossum-1/+0
1996-10-25New permission notice, includes CNRI.Guido van Rossum-12/+19
1996-07-30Added BUILD_SLICE opcode.Guido van Rossum-0/+1
1996-01-12changes for ** (power) operatorGuido van Rossum-0/+2
1995-07-18keyword arguments and faster function callsGuido van Rossum-6/+4
1995-07-07new opcodes RAISE_VARARGS, CALL_FUNCTIONGuido van Rossum-0/+8
1995-01-04Added 1995 copyright.Guido van Rossum-2/+2
object.h: made sizes and refcnts signed ints. stringobject.h: make getstrsize() signed int. methodobject.h: add METH_VARARGS and METH_FREENAME flag bit definitions.
1994-08-01Merge alpha100 branch back to main trunkGuido van Rossum-1/+3
1993-10-18* bltinmodule.c: removed exec() built-in function.Guido van Rossum-0/+2
* Grammar: add exec statement; allow testlist in expr statement. * ceval.c, compile.c, opcode.h: support exec statement; avoid optimizing locals when it is used * fileobject.{c,h}: add getfilename() internal function.
1993-07-28* Added support for X11 modules.Guido van Rossum-0/+11
* Makefile: change location of FORMS library. * posixmodule.c: turn #if 0 into #ifdef MSDOS (stuff in unistd.h or not) * Almost all .h files: added CPP magic to avoid duplicate inclusions and to support inclusion from C++.
1993-05-19Several changes in one:Guido van Rossum-0/+1
(1) dictionaries/mappings now have attributes values() and items() as well as keys(); at the C level, use the new function mappinggetnext() to iterate over a dictionary. (2) "class C(): ..." is now illegal; you must write "class C: ...". (3) Class objects now know their own name (finally!); and minor improvements to the way how classes, functions and methods are represented as strings. (4) Added an "access" statement and semantics. (This is still experimental -- as long as you don't use the keyword 'access' nothing should be changed.)
1993-03-30Changes to speed up local variables enormously, by avoiding dictionaryGuido van Rossum-8/+6
lookup (opcode.h, ceval.[ch], compile.c, frameobject.[ch], pythonrun.c, import.c). The .pyc MAGIC number is changed again. Added get_menu_text to flmodule.
1993-03-29* Changed all copyright messages to include 1993.Guido van Rossum-2/+6
* Stubs for faster implementation of local variables (not yet finished) * Added function name to code object. Print it for code and function objects. THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version number has changed accordingly) * Print address of self for built-in methods * New internal functions getattro and setattro (getattr/setattr with string object arg) * Replaced "dictobject" with more powerful "mappingobject" * New per-type functio tp_hash to implement arbitrary object hashing, and hashobject() to interface to it * Added built-in functions hash(v) and hasattr(v, 'name') * classobject: made some functions static that accidentally weren't; added __hash__ special instance method to implement hash() * Added proper comparison for built-in methods and functions
1992-04-05Copyright for 1992 addedGuido van Rossum-1/+1
1992-01-14Added UNPACK_VARARG.Guido van Rossum-0/+1
1991-12-16Added UNPACK_ARG.Guido van Rossum-1/+3
1991-12-10Added _GLOBAL opcodes.Guido van Rossum-0/+2
1991-10-24Added shift and mask ops.Guido van Rossum-0/+8
1991-04-04Added opcodes to load local/global variablesGuido van Rossum-0/+3
1991-02-19Added copyright notice.Guido van Rossum-0/+24
1990-12-20"Compiling" versionGuido van Rossum-1/+6
1990-11-18Added opcodes for classes.Guido van Rossum-0/+2
1990-11-18Initial revisionGuido van Rossum-0/+78