summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Merged revisions 70463 via svnmerge fromBenjamin Peterson2009-03-181-1/+11
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r70463 | benjamin.peterson | 2009-03-18 15:52:15 -0500 (Wed, 18 Mar 2009) | 1 line fix strange errors when setting attributes on tracebacks #4034 ........
* Merged revisions 66739 via svnmerge fromChristian Heimes2008-10-021-1/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r66739 | christian.heimes | 2008-10-02 20:33:41 +0200 (Thu, 02 Oct 2008) | 1 line Fixed a comment to C89 style as of http://drj11.wordpress.com/2008/10/02/python-and-bragging-about-c89/ ........
* Issue2378: pdb would delete free variables when stepping into a class statement.Amaury Forgeot d'Arc2008-07-211-3/+6
| | | | | The problem was introduced by r53954, the correction is to restore the symmetry between PyFrame_FastToLocals and PyFrame_LocalsToFast
* Added additional __sizeof__ implementations and addressed comments made inRobert Schuppenies2008-07-101-1/+24
| | | | Issue3122.
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-5/+5
| | | | | | | http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-5/+5
|
* 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.