summaryrefslogtreecommitdiff
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* Reduce buffer size since we do not need 1kNeal Norwitz2008-01-271-1/+1
|
* Fix two crashers.Guido van Rossum2008-01-231-1/+5
|
* #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.
* Give meaning to the oparg for BUILD_MAP: estimated size of the dictionary.Raymond Hettinger2007-12-181-1/+1
| | | | | | | | | | | Allows dictionaries to be pre-sized (upto 255 elements) saving time lost to re-sizes with their attendant mallocs and re-insertions. Has zero effect on small dictionaries (5 elements or fewer), a slight benefit for dicts upto 22 elements (because they had to resize once anyway), and more benefit for dicts upto 255 elements (saving multiple resizes during the build-up and reducing the number of collisions on the first insertions). Beyond 255 elements, there is no addional benefit.
* Speed-up dictionary constructor by about 10%.Raymond Hettinger2007-12-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | New opcode, STORE_MAP saves the compiler from awkward stack manipulations and specializes for dicts using PyDict_SetItem instead of PyObject_SetItem. Old disassembly: 0 BUILD_MAP 0 3 DUP_TOP 4 LOAD_CONST 1 (1) 7 ROT_TWO 8 LOAD_CONST 2 ('x') 11 STORE_SUBSCR 12 DUP_TOP 13 LOAD_CONST 3 (2) 16 ROT_TWO 17 LOAD_CONST 4 ('y') 20 STORE_SUBSCR New disassembly: 0 BUILD_MAP 0 3 LOAD_CONST 1 (1) 6 LOAD_CONST 2 ('x') 9 STORE_MAP 10 LOAD_CONST 3 (2) 13 LOAD_CONST 4 ('y') 16 STORE_MAP
* Silence a warning about an unsed variable in debug buildsChristian Heimes2007-12-141-2/+3
|
* Fix typo.Georg Brandl2007-12-051-1/+1
|
* Merge from py3k branch:Amaury Forgeot d'Arc2007-11-131-7/+12
| | | | | | | | | | | | | | | | | | | | | | Correction for issue1265 (pdb bug with "with" statement). When an unfinished generator-iterator is garbage collected, PyEval_EvalFrameEx is called with a GeneratorExit exception set. This leads to funny results if the sys.settrace function itself makes use of generators. A visible effect is that the settrace function is reset to None. Another is that the eventual "finally" block of the generator is not called. It is necessary to save/restore the exception around the call to the trace function. This happens a lot with py3k: isinstance() of an ABCMeta instance runs def __instancecheck__(cls, instance): """Override for isinstance(instance, cls).""" return any(cls.__subclasscheck__(c) for c in {instance.__class__, type(instance)}) which lets an opened generator expression each time it returns True. Backport candidate, even if the case is less frequent in 2.5.
* Add build option for faster loop execution.Raymond Hettinger2007-11-071-0/+11
|
* Try harder to stay within the 79-column limit. There's still two places that ↵Thomas Wouters2007-09-201-44/+55
| | | | go (way) over, but those are harder to fix without suffering in readability.
* Whitespace cleanup.Thomas Wouters2007-09-191-27/+27
|
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-1/+1
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Patch #1686487: you can now pass any mapping after '**' in function calls.Georg Brandl2007-05-211-10/+29
|
* Remove an XXX that is unnecessary.Georg Brandl2007-05-111-1/+0
|
* Fix a bug when using the __lltrace__ opcode tracer, and a problem sith ↵Kristján Valur Jónsson2007-04-131-1/+1
| | | | signed chars in frameobject.c which can occur with opcodes > 127
* Patch #1682205: a TypeError while unpacking an iterable is no longerGeorg Brandl2007-03-211-5/+3
| | | | masked by a generic one with the message "unpack non-sequence".
* Patch #1674228: when assigning a slice (old-style), check for theGeorg Brandl2007-03-051-1/+1
| | | | sq_ass_slice instead of the sq_slice slot.
* Reformat long lines.Jeremy Hylton2007-02-261-2/+4
|
* Put declarations before code.Jeremy Hylton2007-02-251-1/+1
|
* Fix crash in exec when unicode filename can't be decoded.Jeremy Hylton2007-02-251-0/+2
| | | | | | | I can't think of an easy way to test this behavior. It only occurs when the file system default encoding and the interpreter default encoding are different, such that you can open the file but not decode its name.
* No more raising of string exceptions!Brett Cannon2007-01-301-13/+34
| | | | | | | The next step of PEP 352 (for 2.6) causes raising a string exception to trigger a TypeError. Trying to catch a string exception raises a DeprecationWarning. References to string exceptions has been removed from the docs since they are now just an error.
* SF# 1409443: Expand comment to cover the interaction between f->f_lasti and ↵Raymond Hettinger2007-01-061-1/+10
| | | | the PREDICT macros.
* Forgot a case where the locals can now be a general mappingArmin Rigo2006-11-291-1/+3
| | | | instead of just a dictionary. (backporting...)
* [Bug #1542016] Report PCALL_POP value. This makes the return value of ↵Andrew M. Kuchling2006-10-271-2/+2
| | | | | | | sys.callstats() match its docstring. Backport candidate. Though it's an API change, this is a pretty obscure portion of the API.
* Move/copy assert for tstate != NULL before first use.Neal Norwitz2006-08-131-1/+7
| | | | | | Verify that PyEval_Get{Globals,Locals} returned valid pointers. Klocwork 231-232
* Patch #1538606, Patch to fix __index__() clipping.Neal Norwitz2006-08-121-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.
* Whoops, how did that get in there. :-) Revert all the parts of 51227 that ↵Neal Norwitz2006-08-121-9/+0
| | | | were not supposed to go it. Only Modules/_ctypes/cfields.c was supposed to be changed
* Check returned pointer is valid.Neal Norwitz2006-08-121-0/+9
| | | | Klocwork #233
* Concatenation on a long string breaks (SF #1526585).Armin Rigo2006-08-091-3/+9
|
* i and j are initialized below when used. No need to do it twiceNeal Norwitz2006-06-121-1/+1
|
* Get rid of f_restricted too. Doc the other 4 ints that were already removedNeal Norwitz2006-06-121-1/+1
| | | | at the NeedForSpeed sprint.
* Patch #1495999: Part two of Windows CE changes.Martin v. Löwis2006-06-101-1/+1
| | | | | | - update header checks, using autoconf - provide dummies for getenv, environ, and GetVersion - adjust MSC_VER check in socketmodule.c
* [ 1497053 ] Let dicts propagate the exceptions in user __eq__().Armin Rigo2006-06-011-2/+13
| | | | [ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
* needforspeed: backed out the Py_LOCAL-isation of ceval; the massive in-Fredrik Lundh2006-05-271-60/+55
| | | | | lining killed performance on certain Intel boxes, and the "aggressive" macro itself gives most of the benefits on others.
* Patch 1145039.Tim Peters2006-05-261-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.
* Py_LOCAL shouldn't be used for data; it works for some .NET 2003 compilers,Fredrik Lundh2006-05-261-1/+1
| | | | but Trent's copy thinks that it's an anachronism...
* needforspeed: added PY_LOCAL_AGGRESSIVE macro to enable "aggressive"Fredrik Lundh2006-05-261-15/+23
| | | | LOCAL inlining; also added some missing whitespace
* needforspeed: added Py_LOCAL macro, based on the LOCAL macro usedFredrik Lundh2006-05-261-53/+53
| | | | | for SRE and others. applied Py_LOCAL to relevant portion of ceval, which gives a 1-2% speedup on my machine. ymmv.
* Replace PyObject_CallFunction calls with only object argsGeorg Brandl2006-05-251-1/+1
| | | | with PyObject_CallFunctionObjArgs, which is 30% faster.
* Applied patch 1337051 by Neal Norwitz, saving 4 ints on frame objects.Richard Jones2006-05-231-17/+17
|
* Fix #132 from Coverity, retval could have been derefedNeal Norwitz2006-05-191-0/+4
| | | | if a continue inside a try failed.
* Micro optimization. In the first case, we know that frame->f_exc_typeNeal Norwitz2006-05-091-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.
* Fix more ssize_t issues.Martin v. Löwis2006-04-221-2/+2
|
* Teach Python/ceval.c's inlining of 'str += str' about Py_ssize_t sizes; thisThomas Wouters2006-04-191-2/+2
| | | | was having funny effects when called on >2Gb strings ;P
* Refactor: Move code that uses co_lnotab from ceval to codeobjectJeremy Hylton2006-04-181-117/+14
|
* low-hanging fruit in Python/ - g++ still hates all the enum_kind declarationsAnthony Baxter2006-04-111-2/+2
| | | | in Python/Python-ast.c. Not sure what to do about those.
* SF Patch #1463867: Improved generator finalization to allow generatorsPhillip J. Eby2006-04-101-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.
* answer a question from a commentArmin Rigo2006-03-281-3/+3
|
* Fix a ssize_t issueNeal Norwitz2006-03-231-1/+1
|
* Um, I thought I'd already checked this in.Guido van Rossum2006-03-101-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.