summaryrefslogtreecommitdiff
path: root/Python/ceval.c
AgeCommit message (Collapse)AuthorLines
2006-08-13Move/copy assert for tstate != NULL before first use.Neal Norwitz-1/+7
Verify that PyEval_Get{Globals,Locals} returned valid pointers. Klocwork 231-232
2006-08-12Patch #1538606, Patch to fix __index__() clipping.Neal Norwitz-9/+9
I modified this patch some by fixing style, some error checking, and adding XXX comments. This patch requires review and some changes are to be expected. I'm checking in now to get the greatest possible review and establish a baseline for moving forward. I don't want this to hold up release if possible.
2006-08-12Whoops, how did that get in there. :-) Revert all the parts of 51227 that ↵Neal Norwitz-9/+0
were not supposed to go it. Only Modules/_ctypes/cfields.c was supposed to be changed
2006-08-12Check returned pointer is valid.Neal Norwitz-0/+9
Klocwork #233
2006-08-09Concatenation on a long string breaks (SF #1526585).Armin Rigo-3/+9
2006-06-12i and j are initialized below when used. No need to do it twiceNeal Norwitz-1/+1
2006-06-12Get rid of f_restricted too. Doc the other 4 ints that were already removedNeal Norwitz-1/+1
at the NeedForSpeed sprint.
2006-06-10Patch #1495999: Part two of Windows CE changes.Martin v. Löwis-1/+1
- update header checks, using autoconf - provide dummies for getenv, environ, and GetVersion - adjust MSC_VER check in socketmodule.c
2006-06-01[ 1497053 ] Let dicts propagate the exceptions in user __eq__().Armin Rigo-2/+13
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
2006-05-27needforspeed: backed out the Py_LOCAL-isation of ceval; the massive in-Fredrik Lundh-60/+55
lining killed performance on certain Intel boxes, and the "aggressive" macro itself gives most of the benefits on others.
2006-05-26Patch 1145039.Tim Peters-41/+56
set_exc_info(), reset_exc_info(): By exploiting the likely (who knows?) invariant that when an exception's `type` is NULL, its `value` and `traceback` are also NULL, save some cycles in heavily-executed code. This is a "a kronar saved is a kronar earned" patch: the speedup isn't reliably measurable, but it obviously does reduce the operation count in the normal (no exception raised) path through PyEval_EvalFrameEx(). The tim-exc_sanity branch tries to push this harder, but is still blowing up (at least in part due to pre-existing subtle bugs that appear to have no other visible consequences!). Not a bugfix candidate.
2006-05-26Py_LOCAL shouldn't be used for data; it works for some .NET 2003 compilers,Fredrik Lundh-1/+1
but Trent's copy thinks that it's an anachronism...
2006-05-26needforspeed: added PY_LOCAL_AGGRESSIVE macro to enable "aggressive"Fredrik Lundh-15/+23
LOCAL inlining; also added some missing whitespace
2006-05-26needforspeed: added Py_LOCAL macro, based on the LOCAL macro usedFredrik Lundh-53/+53
for SRE and others. applied Py_LOCAL to relevant portion of ceval, which gives a 1-2% speedup on my machine. ymmv.
2006-05-25Replace PyObject_CallFunction calls with only object argsGeorg Brandl-1/+1
with PyObject_CallFunctionObjArgs, which is 30% faster.
2006-05-23Applied patch 1337051 by Neal Norwitz, saving 4 ints on frame objects.Richard Jones-17/+17
2006-05-19Fix #132 from Coverity, retval could have been derefedNeal Norwitz-0/+4
if a continue inside a try failed.
2006-05-09Micro optimization. In the first case, we know that frame->f_exc_typeNeal Norwitz-3/+1
is NULL, so there's no reason to do anything with it. In the second case, we know frame->f_exc_type is not NULL, so we can just do an INCREF.
2006-04-22Fix more ssize_t issues.Martin v. Löwis-2/+2
2006-04-19Teach Python/ceval.c's inlining of 'str += str' about Py_ssize_t sizes; thisThomas Wouters-2/+2
was having funny effects when called on >2Gb strings ;P
2006-04-18Refactor: Move code that uses co_lnotab from ceval to codeobjectJeremy Hylton-117/+14
2006-04-11low-hanging fruit in Python/ - g++ still hates all the enum_kind declarationsAnthony Baxter-2/+2
in Python/Python-ast.c. Not sure what to do about those.
2006-04-10SF Patch #1463867: Improved generator finalization to allow generatorsPhillip J. Eby-0/+3
that are suspended outside of any try/except/finally blocks to be garbage collected even if they are part of a cycle. Generators that suspend inside of an active try/except or try/finally block (including those created by a ``with`` statement) are still not GC-able if they are part of a cycle, however.
2006-03-28answer a question from a commentArmin Rigo-3/+3
2006-03-23Fix a ssize_t issueNeal Norwitz-1/+1
2006-03-10Um, I thought I'd already checked this in.Guido van Rossum-22/+25
Anyway, this is the changes to the with-statement so that __exit__ must return a true value in order for a pending exception to be ignored. The PEP (343) is already updated.
2006-03-07Checking in the code for PEP 357.Guido van Rossum-46/+22
This was mostly written by Travis Oliphant. I've inspected it all; Neal Norwitz and MvL have also looked at it (in an earlier incarnation).
2006-03-07SF #1444030: Fix several potential defects found by Coverity.Hye-Shik Chang-1/+4
(reviewed by Neal Norwitz)
2006-03-02Use Py_ssize_t since we are working with list size belowNeal Norwitz-1/+1
2006-03-01Put back the essence of Jeremy's original XXX comment.Thomas Wouters-1/+3
2006-03-01PEP 352 implementation. Creates a new base class, BaseException, which has anBrett Cannon-5/+5
added message attribute compared to the previous version of Exception. It is also a new-style class, making all exceptions now new-style. KeyboardInterrupt and SystemExit inherit from BaseException directly. String exceptions now raise DeprecationWarning. Applies patch 1104669, and closes bugs 1012952 and 518846.
2006-02-28Updates to the with-statement:Guido van Rossum-6/+20
- New semantics for __exit__() -- it must re-raise the exception if type is not None; the with-statement itself doesn't do this. (See the updated PEP for motivation.) - Added context managers to: - file - thread.LockType - threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore} - decimal.Context - Added contextlib.py, which defines @contextmanager, nested(), closing(). - Unit tests all around; bot no docs yet.
2006-02-28SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters-6/+17
- IMPORT_NAME takes an extra argument from the stack: the relativeness of the import. Only passed to __import__ when it's not -1. - __import__() takes an optional 5th argument for the same thing; it __defaults to -1 (old semantics: try relative, then absolute) - 'from . import name' imports name (be it module or regular attribute) from the current module's *package*. Likewise, 'from .module import name' will import name from a sibling to the current module. - Importing from outside a package is not allowed; 'from . import sys' in a toplevel module will not work, nor will 'from .. import sys' in a (single-level) package. - 'from __future__ import absolute_import' will turn on the new semantics for import and from-import: imports will be absolute, except for from-import with dots. Includes tests for regular imports and importhooks, parser changes and a NEWS item, but no compiler-package changes or documentation changes.
2006-02-27Check the return code for PyErr_Warn() when warning about raising stringBrett Cannon-4/+5
exceptions. This was triggered when 'warnings' had a filter set to "error" that caught the string exception deprecation warning.
2006-02-27PEP 343 -- the with-statement.Guido van Rossum-7/+42
This was started by Mike Bland and completed by Guido (with help from Neal). This still needs a __future__ statement added; Thomas is working on Michael's patch for that aspect. There's a small amount of code cleanup and refactoring in ast.c, compile.c and ceval.c (I fixed the lltrace behavior when EXT_POP is used -- however I had to make lltrace a static global).
2006-02-19Bug #801349: document that start/stop/step slice arguments can be NoneGeorg Brandl-1/+1
2006-02-17Remove size constraints in SLICE opcodes.Martin v. Löwis-16/+11
2006-02-15Merge ssize_t branch.Martin v. Löwis-5/+8
2006-02-10Explain the clearing of the stack in a comment in Python/ceval.c'sThomas Wouters-1/+2
call_function(), rather than commenting on the lack of an explanation in a comment.
2005-12-10Add const to several API functions that take char *.Jeremy Hylton-2/+2
In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
2005-10-21Fix some mods that got dropped from the AST mergeNeal Norwitz-2/+2
2005-10-20Merge ast-branch to headJeremy Hylton-30/+15
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.
2005-09-20clean-up tracing of C functions. In particular, don't call the trace funcArmin Rigo-26/+31
with an exception currently set!
2005-08-15Port from the Python 2.4 branch, patches for SF bug # 900092,Barry Warsaw-8/+14
hotshot.stats.load.
2005-08-02PEP 342 implementation. Per Guido's comments, the generator throw()Phillip J. Eby-3/+15
method still needs to support string exceptions, and allow None for the third argument. Documentation updates are needed, too.
2005-06-25Fix signedness of various char variables to stop causing a warning under gcc 4.Brett Cannon-1/+1
2005-06-25Add comments about PyThreadState and the usage of its fields.Brett Cannon-0/+4
2005-04-04Make a handy macro, Py_DEFAULT_RECURSION_LIMIT to allow to defineHye-Shik Chang-2/+5
a default value of recursion limit from build systems. 1000 levels are still too high for some 64bit systems.
2005-01-18Change the name of the macro used by --with-tsc builds to the lessMichael W. Hudson-29/+32
inscrutable READ_TIMESTAMP.
2005-01-08comment tweakSkip Montanaro-1/+1