summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Implemented Martin's suggestion to clear the free lists during the garbage ↵Christian Heimes2008-02-141-3/+11
| | | | collection of the highest generation.
* Unified naming convention for free lists and their limits. All free listsChristian Heimes2008-02-061-3/+4
| | | | | | | | in Object/ are named ``free_list``, the counter ``numfree`` and the upper limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block. The chances should make it easier to adjust Python for platforms with less memory, e.g. mobile phones.
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-1/+1
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-3/+2
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Silence a compiler warning about incompatible pointer types.Brett Cannon2007-04-191-1/+1
|
* Fix a bug when using the __lltrace__ opcode tracer, and a problem sith ↵Kristján Valur Jónsson2007-04-131-2/+2
| | | | signed chars in frameobject.c which can occur with opcodes > 127
* tabifyJeremy Hylton2007-02-271-97/+97
|
* Fix assertion.Jeremy Hylton2007-02-261-2/+2
|
* Do not copy free variables to locals in class namespaces.Jeremy Hylton2007-02-261-19/+75
| | | | | | | | | Fixes bug 1569356, but at the cost of a minor incompatibility in locals(). Add test that verifies that the class namespace is not polluted. Also clarify the behavior in the library docs. Along the way, cleaned up the dict_to_map and map_to_dict implementations and added some comments that explain what they do.
* Move the initialization of some pointers earlier. The problem isNeal Norwitz2006-07-211-1/+1
| | | | | that if we call Py_DECREF(frame) like we do if allocating locals fails, frame_dealloc() will try to use these bogus values and crash.
* Get rid of f_restricted too. Doc the other 4 ints that were already removedNeal Norwitz2006-06-121-2/+7
| | | | at the NeedForSpeed sprint.
* f_code can't be NULL based on Frame_New and other code that derefs it.Neal Norwitz2006-06-111-2/+2
| | | | So there doesn't seem to be much point to checking here.
* fix broken mergeRichard Jones2006-05-231-7/+2
|
* Applied patch 1337051 by Neal Norwitz, saving 4 ints on frame objects.Richard Jones2006-05-231-34/+32
|
* Merge from rjones-funccall branch.Richard Jones2006-05-231-62/+97
| | | | | | Applied patch zombie-frames-2.diff from sf patch 876206 with updates for Python 2.5 and also modified to retain the free_list to avoid the 67% slow-down in pybench recursion test. 5% speed up in function call pybench.
* frame_clear(): Explain why it's important to make the frameTim Peters2006-04-151-18/+11
| | | | | look dead right at the start. Use Py_CLEAR for four more frame members.
* frame_traverse(): Use the standard Py_VISIT macro.Tim Peters2006-04-151-16/+14
| | | | | | | Py_VISIT: cast the `op` argument to PyObject* when calling `visit()`. Else the caller has to pay too much attention to this silly detail (e.g., frame_traverse needs to traverse `struct _frame *` and `PyCodeObject *` pointers too).
* Trimmed trailing whitespace.Tim Peters2006-04-151-13/+12
|
* Fix SF#1470508: crash in generator cycle finalization. There were twoPhillip J. Eby2006-04-151-9/+11
| | | | | | | | | | | problems: first, PyGen_NeedsFinalizing() had an off-by-one bug that prevented it from ever saying a generator didn't need finalizing, and second, frame objects cleared themselves in a way that caused their owning generator to think they were still executable, causing a double deallocation of objects on the value stack if there was still a loop on the block stack. This revision also removes some unnecessary close() operations from test_generators that are now appropriately handled by the cycle collector.
* Use macro versions instead of function versions when we already know the type.Neal Norwitz2006-03-201-2/+2
| | | | | | | | This will hopefully get rid of some Coverity warnings, be a hint to developers, and be marginally faster. Some asserts were added when the type is currently known, but depends on values from another function.
* Merge ssize_t branch.Martin v. Löwis2006-02-151-11/+11
|
* Fix a bunch of imports to use code.h instead of compile.h.Jeremy Hylton2005-10-211-1/+0
| | | | Remove duplicate declarations from compile.h
* Merge ast-branch to headJeremy Hylton2005-10-201-0/+1
| | | | | | | | | | This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
* SF Bug #215126: Over restricted type checking on eval() functionRaymond Hettinger2004-07-021-6/+9
| | | | | | 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.
* memset() with small memory sizes just kill us.Armin Rigo2004-03-201-2/+4
|
* Two forgotten Py_DECREF() for two out-of-memory conditions.Armin Rigo2004-01-271-2/+6
|
* Removing bogus Py_DECREF() reported by Armin Rigo (SF bug 812353).Jeremy Hylton2003-10-211-1/+0
| | | | | Even if a new dict is generated for locals, it is stored in f->f_locals.
* Fix indentation.Jeremy Hylton2003-10-211-1/+1
|
* Fix silly typo in comment.Michael W. Hudson2003-08-111-1/+1
|
* Refactor the logic for setting f_builtins.Jeremy Hylton2003-02-051-24/+31
| | | | | | | For the case where the current globals match the previous frame's globals, eliminates three tests in two if statements. For the case where we just get __builtins__ from a module, eliminate a couple of tests.
* Since the *_Init() are private, prefix with _, suggested by SkipNeal Norwitz2002-12-311-1/+1
|
* SF #561244, Micro optimizationsNeal Norwitz2002-12-301-9/+13
| | | | | | Initialize the small integers and __builtins__ in startup. This removes some if conditions. Change XDECREF to DECREF for values which shouldn't be NULL.
* Fix bug introduced by SF patch #643835, Set Next Statement for Python debuggersNeal Norwitz2002-12-191-4/+12
| | | | | | blockstack_top could be 0 when blockstack[blockstack_top-1] was referenced (ie blockstack[-1]) which crashed on hpux. Patch & fix by Richie Hindle
* Undefine MIN and MAX before definingNeal Norwitz2002-12-181-0/+2
| | | | Some systems (HPUX at least) already define MIN/MAX for us
* This is Richie Hindle's patchMichael W. Hudson2002-12-171-1/+259
| | | | | | | | [ 643835 ] Set Next Statement for Python debuggers with a few tweaks by me: adding an unsigned or two, mentioning that not all jumps are allowed in the doc for pdb, adding a NEWS item and a note to whatsnew, and AuCTeX doing something cosmetic to libpdb.tex.
* A slight change to SET_LINENO-less tracing.Michael W. Hudson2002-09-111-2/+36
| | | | | This makes things a touch more like 2.2. Read the comments in Python/ceval.c for more details.
* SF #561244: micro optimizations, builtins cannot be NULL, so use Py_INCREFNeal Norwitz2002-08-291-1/+1
|
* Check in my ultra-shortlived patch #597220.Michael W. Hudson2002-08-191-3/+3
| | | | | | Move some debugging checks inside Py_DEBUG. They were causing cache misses according to cachegrind.
* This is my patchMichael W. Hudson2002-08-151-2/+12
| | | | | | | | [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change.
* Tim found that once test_longexp has run, test_sort takes very muchGuido van Rossum2002-08-011-5/+3
| | | | | | | | | | | | longer to run than normal. A profiler run showed that this was due to PyFrame_New() taking up an unreasonable amount of time. A little thinking showed that this was due to the while loop clearing the space available for the stack. The solution is to only clear the local variables (and cells and free variables), not the space available for the stack, since anything beyond the stack top is considered to be garbage anyway. Also, use memset() instead of a while loop counting backwards. This should be a time savings for normal code too! (By a probably unmeasurable amount. :-)
* Fix SF bug #505315: Make free and cell vars show up consistently in locals().Jeremy Hylton2002-04-201-6/+7
| | | | | | | | | | PyFrame_FastToLocals() and PyFrame_LocalsToFast() had a return if f_nlocals was 0. I think this was a holdover from the pre 2.1 days when regular locals were the only kind of local variables. The change makes it possible to use a free variable in eval or exec if it the variable is also used elsewhere in the same block, which is what the documentation says.
* SF bug 543148: Memory leak with stackframes + inspect.Tim Peters2002-04-131-2/+17
| | | | | | | | Put a bound on the number of frameobjects that can live in the frameobject free_list. Am also backporting to 2.2. I don't intend to backport to 2.1 (too much work -- lots of cyclic structures leak there, and the GC API).
* This is Neil's fix for SF bug 535905 (Evil Trashcan and GC interaction).Guido van Rossum2002-03-281-1/+1
| | | | | | | | The fix makes it possible to call PyObject_GC_UnTrack() more than once on the same object, and then move the PyObject_GC_UnTrack() call to *before* the trashcan code is invoked. BUGFIX CANDIDATE!
* Fix memory leak in dict_to_map(), SF bug [ #485152 ] memory leak in test_scope.Jeremy Hylton2001-12-061-8/+11
| | | | | | | | | | | | PyCell_Set() incremenets the reference count, so the earlier XINCREF causes a leak. Also make a number of small performance improvements to the code on the assumption that most of the time variables are not rebound across a FastToLocals() / LocalsToFast() pair. Replace uses of PyCell_Set() and PyCell_Get() with PyCell_SET() and PyCell_GET(), since the frame is guaranteed to contain cells.
* Add optional docstrings to getset descriptors. Fortunately, there'sGuido van Rossum2001-09-201-1/+1
| | | | | | | | | | no backwards compatibility to worry about, so I just pushed the 'closure' struct member to the back -- it's never used in the current code base (I may eliminate it, but that's more work because the getter and setter signatures would have to change.) As examples, I added actual docstrings to the getset attributes of a few types: file.closed, xxsubtype.spamdict.state.
* Add optional docstrings to member descriptors. For backwardsGuido van Rossum2001-09-201-1/+1
| | | | | | | | | | | | | | | compatibility, this required all places where an array of "struct memberlist" structures was declared that is referenced from a type's tp_members slot to change the type of the structure to PyMemberDef; "struct memberlist" is now only used by old code that still calls PyMember_Get/Set. The code in PyObject_GenericGetAttr/SetAttr now calls the new APIs PyMember_GetOne/SetOne, which take a PyMemberDef argument. As examples, I added actual docstrings to the attributes of a few types: file, complex, instance method, super, and xxsubtype.spamlist. Also converted the symtable to new style getattr.
* Squash new compiler wng in debug build.Tim Peters2001-08-301-1/+1
|
* Make frames a PyVarObject. Use new GC API.Neil Schemenauer2001-08-291-30/+14
|
* Merge of descr-branch back into trunk.Tim Peters2001-08-021-14/+21
|
* GC for frame objects.Neil Schemenauer2001-07-121-12/+101
|