summaryrefslogtreecommitdiffstats
path: root/Include/frameobject.h
Commit message (Collapse)AuthorAgeFilesLines
* SF Bug #215126: Over restricted type checking on eval() functionRaymond Hettinger2004-07-021-1/+1
| | | | | | The builtin eval() function now accepts any mapping for the locals argument. Time sensitive steps guarded by PyDict_CheckExact() to keep from slowing down the normal case. My timings so no measurable impact.
* A slight change to SET_LINENO-less tracing.Michael W. Hudson2002-09-111-0/+2
| | | | | This makes things a touch more like 2.2. Read the comments in Python/ceval.c for more details.
* Excise DL_EXPORT from Include.Mark Hammond2002-08-121-7/+7
| | | | Thanks to Skip Montanaro and Kalle Svensson for the patches.
* SF patch # 580411, move frame macros from frameobject.h into ceval.cNeal Norwitz2002-07-141-20/+0
| | | | | remove unused macros use co alias instead of f->f_code in macros
* Make frames a PyVarObject instead of a PyObject.Neil Schemenauer2001-08-291-2/+1
|
* PyFrameObject: rename f_stackbottom to f_stacktop, since it points toTim Peters2001-06-231-2/+4
| | | | | | | | the next free valuestack slot, not to the base (in America, stacks push and pop at the top -- they mutate at the bottom in Australia <winK>). eval_frame(): assert that f_stacktop isn't NULL upon entry. frame_delloc(): avoid ordered pointer comparisons involving f_stacktop when f_stacktop is NULL.
* Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters2001-06-181-0/+2
| | | | | Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
* Variety of small INC/DECREF patches that fix reported memory leaksJeremy Hylton2001-03-131-2/+1
| | | | | | | | | | | | | | | | | | | | | with free variables. Thanks to Martin v. Loewis for finding two of the problems. This fixes SF buf 405583. There is also a C API change: PyFrame_New() is reverting to its pre-2.1 signature. The change introduced by nested scopes was a mistake. XXX Is this okay between beta releases? cell_clear(), the GC helper, must decref its reference to break cycles. frame_dealloc() must dealloc all cell vars and free vars in addition to locals. eval_code2() setup code must INCREF cells it copies out of the closure. The STORE_DEREF opcode implementation must DECREF the object it passes to PyCell_Set().
* Remove f_closure slot of frameobject and use f_localsplus instead.Jeremy Hylton2001-01-291-1/+3
| | | | | | | | | | | | This change eliminates an extra malloc/free when a frame with free variables is created. Any cell vars or free vars are stored in f_localsplus after the locals and before the stack. eval_code2() fills in the appropriate values after handling initialization of locals. To track the size the frame has an f_size member that tracks the total size of f_localsplus. It used to be implicitly f_nlocals + f_stacksize.
* PEP 227 implementationJeremy Hylton2001-01-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* ANSI-fication and Py_PROTO extermination.Fred Drake2000-07-091-35/+34
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Add DL_IMPORT(returntype) for all officially exported functions.Guido van Rossum1998-12-041-6/+6
|
* Massive changes for separate thread state management.Guido van Rossum1997-05-051-1/+3
| | | | | All per-thread globals are moved into a struct which is manipulated separately.
* New lay-out of frame object, for fewer mallocs.Guido van Rossum1997-01-201-9/+8
| | | | See frameobject.c checkin message.
* Rename DEBUG macro to Py_DEBUGGuido van Rossum1996-12-301-1/+1
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* don't use NDEBUGGuido van Rossum1996-05-241-1/+1
|
* keyword arguments and faster function callsGuido van Rossum1995-07-181-1/+0
|
* make the type a parameter of the DL_IMPORT macro, for Borland CGuido van Rossum1995-02-271-1/+1
|
* new names for lots of new functionsGuido van Rossum1995-01-171-3/+3
|
* The great renaming, phase two: all header files have been updated toGuido van Rossum1995-01-121-28/+31
| | | | | | | use the new names exclusively, and the linker will see the new names. Files that import "Python.h" also only see the new names. Files that import "allobjects.h" will continue to be able to use the old names, due to the inclusion (in allobjects.h) of "rename2.h".
* __builtins__ mods (and sys_checkinterval for ceval.c)Guido van Rossum1995-01-091-0/+2
|
* Added 1995 copyright.Guido van Rossum1995-01-041-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.
* Changes for dynamic linking under NTGuido van Rossum1994-08-181-1/+1
|
* Merge alpha100 branch back to main trunkGuido van Rossum1994-08-011-4/+10
|
* * Added support for X11 modules.Guido van Rossum1993-07-281-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++.
* * classobject.c: in instance_getattr, don't make a method out of aGuido van Rossum1993-05-251-1/+1
| | | | | | | | | | function found as instance data. * socketmodule.c: added 'flags' argument sendto/recvfrom, rewrite argument parsing in send/recv. * More changes related to access (terminology change: owner instead of class; allow any object as owner; local/global variables are owned by their dictionary, only class/instance data is owned by the class; "from...import *" now only imports objects with public access; etc.)
* Access checks now work, at least for instance data (not for methodsGuido van Rossum1993-05-201-1/+2
| | | | | | | yet). The class is now passed to eval_code and stored in the current frame. It is also stored in instance method objects. An "unbound" instance method is now returned when a function is retrieved through "classname.funcname", which when called passes the class to eval_code.
* Changes to speed up local variables enormously, by avoiding dictionaryGuido van Rossum1993-03-301-0/+2
| | | | | | 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.
* * Changed all copyright messages to include 1993.Guido van Rossum1993-03-291-2/+2
| | | | | | | | | | | | | | | | | * 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
* * bltinmodule.c: added built-in function cmp(a, b)Guido van Rossum1992-10-181-0/+4
| | | | | | | | | | | | | | | * flmodule.c: added {do,check}_only_forms to fl's list of functions; and don't print a message when an unknown object is returned. * pythonrun.c: catch SIGHUP and SIGTERM to do essential cleanup. * Made jpegmodule.c smaller by using getargs() and mkvalue() consistently. * Increased parser stack size to 500 in parser.h. * Implemented custom allocation of stack frames to frameobject.c and added dynamic stack overflow checks (value stack only) to ceval.c. (There seems to be a bug left: sometimes stack traces don't make sense.)
* Copyright for 1992 addedGuido van Rossum1992-04-051-1/+1
|
* Added f_lasti and f_lineno members.Guido van Rossum1992-01-141-0/+2
|
* Added Getnamev() macro.Guido van Rossum1991-04-031-0/+1
|
* Added copyright notice.Guido van Rossum1991-02-191-0/+24
|
* "Compiling" versionGuido van Rossum1990-12-201-0/+56