summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* Make private functions static so we don't pollute the namespaceNeal Norwitz2002-11-101-1/+1
|
* This is Richie Hindle's patch:Michael W. Hudson2002-11-081-7/+16
| | | | | | | [ 631276 ] Exceptions raised by line trace function It conflicted with the patches from Armin I just checked it, so I had to so some bits by hand.
* Assorted patches from Armin Rigo:Michael W. Hudson2002-11-081-42/+48
| | | | | | | | [ 617309 ] getframe hook (Psyco #1) [ 617311 ] Tiny profiling info (Psyco #2) [ 617312 ] debugger-controlled jumps (Psyco #3) These are forward ports from 2.2.2.
* Handle really big steps in extended slices.Michael W. Hudson2002-11-061-1/+1
| | | | Fixes a test failure on 64 bit platforms (I hope).
* One last tweak to the tracing machinery: this actually computes what I intendedMichael W. Hudson2002-10-031-1/+3
| | | | | | | all along. Before instr_lb tended to be too high. I don't think this actually makes any difference, given what the compiler produces, but it makes me a bit happier.
* Fix for the recursion_level bug Armin Rigo reported in sfMichael W. Hudson2002-10-021-0/+4
| | | | | | | patch #617312, both on the trunk and the 22-maint branch. Also added a test case, and ported the test_trace I wrote for HEAD to 2.2.2 (with all those horrible extra 'line' events ;-).
* A slight change to SET_LINENO-less tracing.Michael W. Hudson2002-09-111-5/+18
| | | | | This makes things a touch more like 2.2. Read the comments in Python/ceval.c for more details.
* Bump default check interval to 100 instructions. Computers are much fasterSkip Montanaro2002-09-031-2/+2
| | | | | | than when this interval was first established. Checking too frequently just adds needless overhead because most of the time there is nothing to do and no other threads ready to run.
* replace thread state objects' ticker and checkinterval fields with twoSkip Montanaro2002-09-031-2/+8
| | | | | | | | | | globals, _Py_Ticker and _Py_CheckInterval. This also implements Jeremy's shortcut in Py_AddPendingCall that zeroes out _Py_Ticker. This allows the test in the main loop to only test a single value. The gory details are at http://python.org/sf/602191
* Further SET_LINENO reomval fixes. See comments in patch #587933.Michael W. Hudson2002-08-301-34/+20
| | | | | | | | | | Use a slightly different strategy to determine when not to call the line trace function. This removes the need for the RETURN_NONE opcode, so that's gone again. Update docs and comments to match. Thanks to Neal and Armin! Also add a test suite. This should have come with the original patch...
* The error messages in err_args() -- which is only called when theGuido van Rossum2002-08-231-2/+2
| | | | | | required number of args is 0 or 1 -- were reversed. Also change "1" into "exactly one", the same words as used elsewhere for this condition.
* Comment typo repair.Michael W. Hudson2002-08-201-1/+1
|
* My patch #597221. Use f_lasti more consistently.Michael W. Hudson2002-08-201-9/+9
|
* Add a warning comment to the LOAD_GLOBAL inline code.Guido van Rossum2002-08-191-1/+3
|
* Another ugly inlining hack, expanding the two PyDict_GetItem() callsGuido van Rossum2002-08-191-1/+25
| | | | | | | | | | | | | | | in LOAD_GLOBAL. Besides saving a C function call, it saves checks whether f_globals and f_builtins are dicts, and extracting and testing the string object's hash code is done only once. We bail out of the inlining if the name is not exactly a string, or when its hash is -1; because of interning, neither should ever happen. I believe interning guarantees that the hash code is set, and I believe that the 'names' tuple of a code object always contains interned strings, but I'm not assuming that -- I'm simply testing hash != -1. On my home machine, this makes a pystone variant with new-style classes and slots run at the same speed as classic pystone! (With new-style classes but without slots, it is still a lot slower.)
* Inline fast_cfunction() in new call_function().Jeremy Hylton2002-08-161-55/+33
| | | | | | | | | Also, don't handle METH_OLDARGS on the fast path. All the interesting builtins have been converted to use METH_NOARGS, METH_O, or METH_VARARGS. Result is another 1-2% speedup. If I can cobble together 10 of these, it might make a difference.
* Move body of CALL_FUNCTION opcode into helper function.Jeremy Hylton2002-08-161-54/+56
| | | | | | | This makes the code much easier to ready, because it is at a sane indentation level. On my box this shows a 1-2% speedup, which means nothing, except that I'm not going to worry about the performance effects of the change.
* Streamline the fast track for CFunction calls a bit more: there wasGuido van Rossum2002-08-161-5/+2
| | | | | | | nothing special done if keyword arguments were present, so test for that earlier and fall through to the normal case if there are any. This ought to slow down CFunction calls with keyword args, but I don't care; it's a tiny (1%) improvement for pystone.
* This is my patchMichael W. Hudson2002-08-151-36/+167
| | | | | | | | [ 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.
* Add weakref support generator-iterators.Fred Drake2002-08-091-1/+7
| | | | Part of fixing SF bug #591704.
* get rid of GETNAMEV macro - use GETITEM directlySkip Montanaro2002-08-061-12/+11
| | | | same idea as getting rid of GETCONST & GETNAME (see patch #506436)
* small speedup for constant and name accessSkip Montanaro2002-08-041-3/+6
| | | | see sf #506436
* SF patch 552161 - Py_AddPendingCall doesn't unlock on fail (DanielGuido van Rossum2002-07-171-1/+3
| | | | | | Dunbar) Can't test this, but looks correct to me.
* Removed more stray instances of statichere, but left _sre.c alone.Tim Peters2002-07-171-1/+1
|
* staticforward bites the dust.Jeremy Hylton2002-07-171-1/+1
| | | | | | | | | | | | | | | The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation.
* There's no need for generators to define an explicit next() method.Tim Peters2002-07-171-22/+1
|
* SF patch # 580411, move frame macros from frameobject.h into ceval.cNeal Norwitz2002-07-141-3/+10
| | | | | remove unused macros use co alias instead of f->f_code in macros
* Don't stomp on an exception set by PyCell_Get()Jeremy Hylton2002-07-111-1/+4
|
* Now FOR_LOOP is gone, loop_subscript can go too.Michael W. Hudson2002-06-141-19/+0
| | | | make -s rules :-)
* The opcode FOR_LOOP no longer exists.Guido van Rossum2002-06-131-31/+0
|
* SF bug 567538: Generator can crash the interpreter (Finn Bock).Guido van Rossum2002-06-121-2/+2
| | | | | | | | | | This was a simple typo. Strange that the compiler didn't catch it! Instead of WHY_CONTINUE, two tests used CONTINUE_LOOP, which isn't a why_code at all, but an opcode; but even though 'why' is declared as an enum, comparing it to an int is apparently not even worth a warning -- not in gcc, and not in VC++. :-( Will fix in 2.2 too.
* Fix forMichael W. Hudson2002-05-201-1/+1
| | | | | | | | | | | [ 558249 ] softspace vs --disable-unicode And #endif was in the wrong place. Bugfix candidate, almost surely. I think I will embark on squashing test failures in --disable-unicode builds -- a Real Bug was hiding under them.
* ceval.c/do_raise(): Tighten the test to disallow raising an instance ofTim Peters2002-04-181-1/+4
| | | | | | | | a str subclass. test_descr.py/string_exceptions(): New sub-test. For 2.3 only. Guido doesn't want this backported.
* Fix an issue that was reported in but unrelated to the main problem ofGuido van Rossum2002-03-281-2/+10
| | | | | | | | | | | | | SF bug 535905 (Evil Trashcan and GC interaction). The SETLOCAL() macro should not DECREF the local variable in-place and then store the new value; it should copy the old value to a temporary value, then store the new value, and then DECREF the temporary value. This is because it is possible that during the DECREF the frame is accessed by other code (e.g. a __del__ method or gc.collect()) and the variable would be pointing to already-freed memory. BUGFIX CANDIDATE!
* SF bug 480215: softspace confused in nested printTim Peters2002-03-241-10/+12
| | | | | | | | | | This fixes the symptom, but PRINT_ITEM has no way to know what (if anything) PyFile_WriteObject() writes unless the object being printed is a string. When the object isn't a string, this fix retains the guess that softspace should be set after PyFile_WriteObject(). We might want to say that it's the job of filelike-object write methods to leave the file's softspace in the correct state. That would probably be better -- but everyone relies on PRINT_ITEM to guess for them now.
* Disable the parser hacks that enabled the "yield" keyword using a futureNeil Schemenauer2002-03-221-0/+2
| | | | statement.
* Re-enable GC of generator objects.Neil Schemenauer2002-03-181-6/+6
|
* Move some opcodes to top of big eval_frame switch statement. SkipNeil Schemenauer2002-02-171-44/+45
| | | | | things_to_do block for a few common opcodes that don't do any real work. Closes SF patch #512256.
* LOAD_FAST: rearrange branches to favor the expected case, and getTim Peters2002-02-121-10/+7
| | | | rid of a redundant NULL-pointer check in the expected case.
* Patch #494783: Rename cmp_op enumerators.Martin v. Löwis2002-01-011-15/+19
|
* SF bug #496549 -Qnew and in-place division "/=".Tim Peters2001-12-251-11/+14
| | | | | | | | eval_frame(): Under -Qnew, INPLACE_DIVIDE wasn't getting handed off to INPLACE_TRUE_DIVIDE (like BINARY_DIVIDE was getting handed off to BINARY_TRUE_DIVIDE). Bugfix candidate.
* SF bug #494668: PUSH() should assert-fail on overflow.Tim Peters2001-12-191-2/+4
| | | | | eval_frame(): Added asserts to the top of the eval loop, to verify that the eval stack pointer is in bounds, plus some comments.
* Patch #494384: Disable more Unicode API if Unicode is not used.Martin v. Löwis2001-12-181-0/+2
|
* _PyEval_SliceIndex(): explain why a NULL argument is allowed (thanksTim Peters2001-12-161-4/+4
| | | | to Guido for the revelation).
* _PyEval_SliceIndex(): Repaired the comments, and added XXX commentsTim Peters2001-12-161-6/+11
| | | | | about its dubious treatment of NULL (also opened a bug report on that, but don't want to risk changing it this late in the 2.2 game).
* Fix for SF bug [ #492403 ] exec() segfaults on closure's func_codeJeremy Hylton2001-12-131-1/+6
| | | | | | | | Based on the patch from Danny Yoo. The fix is in exec_statement() in ceval.c. There are also changes to introduce use of PyCode_GetNumFree() in several places.
* Fix for SF bug #489671 (Neil Norwitz): memory leak in test_richcmp.Guido van Rossum2001-12-061-0/+8
| | | | | | Had nothing to do with rich comparisons -- some stack cleanup code was lost as a result of merging in Neil Schemenauer's generators patch. Reinserted the stack cleanup code, skipping it when yielding.
* Fix a typo (probably caused by autocompletion <blush>) that caused aGuido van Rossum2001-12-061-1/+1
| | | | | | leak when a class defined a __metaclass__. This fixes the problem reported on python-dev by Ping; I dunno if it's the same as SF bug #489669 (since that mentions Unicode).
* SF bug #488514: -Qnew needs workTim Peters2001-12-061-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Big Hammer to implement -Qnew as PEP 238 says it should work (a global option affecting all instances of "/"). pydebug.h, main.c, pythonrun.c: define a private _Py_QnewFlag flag, true iff -Qnew is passed on the command line. This should go away (as the comments say) when true division becomes The Rule. This is deliberately not exposed to runtime inspection or modification: it's a one-way one-shot switch to pretend you're using Python 3. ceval.c: when _Py_QnewFlag is set, treat BINARY_DIVIDE as BINARY_TRUE_DIVIDE. test_{descr, generators, zipfile}.py: fiddle so these pass under -Qnew too. This was just a matter of s!/!//! in test_generators and test_zipfile. test_descr was trickier, as testbinop() is passed assumptions that "/" is the same as calling a "__div__" method; put a temporary hack there to call "__truediv__" instead when the method name is "__div__" and 1/2 evaluates to 0.5. Three standard tests still fail under -Qnew (on Windows; somebody please try the Linux tests with -Qnew too! Linux runs a whole bunch of tests Windows doesn't): test_augassign test_class test_coercion I can't stay awake longer to stare at this (be my guest). Offhand cures weren't obvious, nor was it even obvious that cures are possible without major hackery. Question: when -Qnew is in effect, should calls to __div__ magically change into calls to __truediv__? See "major hackery" at tail end of last paragraph <wink>.
* Fix the final two issues in Armin Rigo's SF bug #488477: apply_slice()Guido van Rossum2001-12-031-4/+10
| | | | | and assign_slice() weren't properly DECREF'ing the temporary slice object they created. (Shame on me. :-)