summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Some errors from range() should be TypeError, not ValueError.Guido van Rossum2003-04-151-3/+3
|
* Extend SF patch #707257: Improve code generationRaymond Hettinger2003-04-151-8/+20
| | | | | | to cover the case for: "x,y,z=1,2,3". Gives a 30% speed-up. Also, added FOR_ITER to the list of opcodes that can jump.
* Prompted by Tim's comment, when handle_range_longs() sees anGuido van Rossum2003-04-141-9/+9
| | | | | unexpected type, report the actual type rather than 'float'. (It's hard to even reach this code with a float. :-)
* handle_range_longs(): refcount handling is very delicate here, andTim Peters2003-04-131-31/+50
| | | | | | | the code erroneously decrefed the istep argument in an error case. This caused a co_consts tuple to lose a float constant prematurely, which eventually caused gc to try executing static data in floatobject.c (don't ask <wink>). So reworked this extensively to ensure refcount correctness.
* Patch by Chad Netzer (with significant change):Guido van Rossum2003-04-111-5/+190
| | | | | | | - range() now works even if the arguments are longs with magnitude larger than sys.maxint, as long as the total length of the sequence fits. E.g., range(2**100, 2**101, 2**100) is the following list: [1267650600228229401496703205376L]. (SF patch #707427.)
* Move declaration of enc to scope where it is usedNeal Norwitz2003-04-101-2/+1
|
* PyErr_NormalizeException(): in the type==NULL test, we should simplyGuido van Rossum2003-04-101-3/+2
| | | | | | | | return. Setting an exception can mess with the exception state, and continuing is definitely wrong (since type is dereferenced later on). Some code that calls this seems to be prepared for a NULL exception type, so let's be safe rather than sorry and simply assume there's nothing to normalize in this case.
* - New function sys.call_tracing() allows pdb to debug codeGuido van Rossum2003-04-092-0/+37
| | | | | | recursively. - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt.
* SF patch #701494: more apply removalsRaymond Hettinger2003-04-061-1/+4
|
* Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.Martin v. Löwis2003-03-292-7/+7
|
* Factored out test for absolute jumps.Raymond Hettinger2003-03-281-2/+3
|
* SF patch #707257: Improve code generationRaymond Hettinger2003-03-261-2/+94
| | | | | | | | | | Adds a single function to improve generated bytecode. Has a single line attachment point, so it is completely de-coupled from both the compiler and ceval.c. Makes three simple transforms that do not require a basic block analysis or re-ordering of code. Gives improved timings on pystone, pybench, and any code using either "while 1" or "x,y=y,x".
* symtable_cellvar_offsets(): This leaked references to little integersTim Peters2003-03-241-1/+5
| | | | | | in normal cases, and also in error cases. Bugfix candidate.
* Improved new Py_TRACE_REFS gimmicks.Tim Peters2003-03-231-2/+16
| | | | | | | | | | | Arranged that all the objects exposed by __builtin__ appear in the list of all objects. I basically peed away two days tracking down a mystery leak in sys.gettotalrefcount() in a ZODB app (== tons of code), because the object leaking the references didn't appear in the sys.getobjects(0) list. The object happened to be False. Now False is in the list, along with other popular & previously missing leak candidates (like None). Alas, we still don't have a choke point covering *all* Python objects, so the list of all objects may still be incomplete.
* SF patch #708201, unchecked return value in import.c by Jason HarperNeal Norwitz2003-03-231-0/+2
| | | | Will backport.
* Include Python.h first which defines _XOPEN_SOURCENeal Norwitz2003-03-221-3/+3
| | | | | which allows the file to compile and removes a warning about _XOPEN_SOURCE being redefined (works on AIX 4.3 and 5.1 at least).
* Fixed SF bug #663074. The codec system was using global staticGustavo Niemeyer2003-03-193-92/+71
| | | | | | | | | variables to store internal data. As a result, any atempts to use the unicode system with multiple active interpreters, or successive interpreter executions, would fail. Now that information is stored into members of the PyInterpreterState structure.
* Eliminate data dependency in predict macro.Raymond Hettinger2003-03-161-2/+8
| | | | | | | | Added two predictions: GET_ITER --> FOR_ITER FOR_ITER --> STORE_FAST or UNPACK_SEQUENCE Improves timings on pybench and timeit.py. Pystone results are neutral.
* Fix comment and whitespace.Raymond Hettinger2003-03-161-3/+4
|
* Introduced macros for a simple opcode prediction protocol.Raymond Hettinger2003-03-161-6/+35
| | | | | | | | | | | | | | | | | | | Applied to common cases: COMPARE_OP is often followed by a JUMP_IF. JUMP_IF is usually followed by POP_TOP. Shows improved timings on PyStone, PyBench, and specific tests using timeit.py: python timeit.py -s "x=1" "if x==1: pass" python timeit.py -s "x=1" "if x==2: pass" python timeit.py -s "x=1" "if x: pass" python timeit.py -s "x=100" "while x!=1: x-=1" Potential future candidates: GET_ITER predicts FOR_ITER FOR_ITER predicts STORE_FAST or UNPACK_SEQUENCE Also, applied missing goto fast_next_opcode to DUP_TOPX.
* SF patch #701907: More use of fast_next_opcodeRaymond Hettinger2003-03-141-11/+11
| | | | | | | | My previous patches should have used fast_next_opcode in a few places instead of continue. Also, applied one PyInt_AS_LONG macro in a place where the type had already been checked.
* Declare all variables at the start of their scope.Fred Drake2003-03-051-1/+1
|
* Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize,Martin v. Löwis2003-03-052-0/+48
| | | | | and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding. Adjust test case.
* Use Carbon.File for FSSpec and FSRef conversion, not macfs.Jack Jansen2003-03-021-4/+4
|
* Added implementation notes for [re]set_exc_info().Guido van Rossum2003-03-011-0/+61
|
* - New function sys.exc_clear() clears the current exception. This isGuido van Rossum2003-03-011-4/+37
| | | | | | rarely needed, but can sometimes be useful to release objects referenced by the traceback held in sys.exc_info()[2]. (SF patch #693195.) Thanks to Kevin Jacobs!
* In the process of adding all the extended slice support I attempted toMichael W. Hudson2003-02-271-4/+4
| | | | | | | change _PyEval_SliceIndex to round massively negative longs up to -INT_MAX, instead of 0 but botched it. Get it right. Thx to Armin for the report.
* Micro-optimizations.Raymond Hettinger2003-02-261-4/+18
| | | | | * List/Tuple checkexact is faster for the common case. * Testing for Py_True and Py_False can be inlined for faster looping.
* Addendum to #683658:Just van Rossum2003-02-251-2/+2
| | | | | | import warnings.py _after_ site.py has run. This ensures that site.py is again the first .py to be imported, giving it back full control over sys.path.
* Remove unused variables.Walter Dörwald2003-02-241-9/+0
|
* Fix SF bug #690435, apply fails to check if warning raises exceptionNeal Norwitz2003-02-231-3/+4
| | | | (patch provided by Greg Chapman)
* After the removal of SET_LINENO, PyCode_Addr2Line has always beenMichael W. Hudson2003-02-221-3/+0
| | | | | | called to find tb_lineno -- even if Py_OptimizeFlag is true. So don't call it again when printing the traceback.
* - PyEval_GetFrame() is now declared to return a PyFrameObject *Guido van Rossum2003-02-192-9/+9
| | | | instead of a plain PyObject *. (SF patch #686601 by Ben Laurie.)
* - sys.path[0] (the directory from which the script is loaded) is nowGuido van Rossum2003-02-191-2/+10
| | | | | turned into an absolute pathname, unless it is the empty string. (SF patch #664376, by Skip Montanaro.)
* Fix bug 683658 - PyErr_Warn may cause import deadlock.Mark Hammond2003-02-192-5/+15
|
* Remove PyArg_ParseTuple() for methods which take no args,Neal Norwitz2003-02-171-23/+13
| | | | use METH_NOARGS instead
* Patch for bug reported in patch #686627: import race condition inMarc-André Lemburg2003-02-141-1/+1
| | | | codecs registry startup.
* - Finally fixed the bug in compile() and exec where a string endingGuido van Rossum2003-02-132-7/+5
| | | | | | | | | with an indented code block but no newline would raise SyntaxError. This would have been a four-line change in parsetok.c... Except codeop.py depends on this behavior, so a compilation flag had to be invented that causes the tokenizer to revert to the old behavior; this required extra changes to 2 .h files, 2 .c files, and 2 .py files. (Fixes SF bug #501622.)
* Cleanup from patch #683257:Neal Norwitz2003-02-121-4/+7
| | | | | | | Add missing INCREFs and re-indent returns to be consistent. Add \n\ for lines in docstring Add a pathetic test Add docs
* Provide access to the import lock, fixing SF bug #580952. This isGuido van Rossum2003-02-121-6/+52
| | | | | | | | mostly from SF patch #683257, but I had to change unlock_import() to return an error value to avoid fatal error. Should this be backported? The patch requested this, but it's a new feature.
* SF #660455 : patch by NNorwitz.Guido van Rossum2003-02-121-1/+2
| | | | | | | | | | "Unsigned" (i.e., positive-looking, but really negative) hex/oct constants with a leading minus sign are once again properly negated. The micro-optimization for negated numeric constants did the wrong thing for such hex/oct constants. The patch avoids the optimization for all hex/oct constants. This needs to be backported to Python 2.2!
* Change filtertuple() to use tp_as_sequence->sq_itemWalter Dörwald2003-02-101-1/+6
| | | | | instead of PyTuple_GetItem, so an overwritten __getitem__ in a tuple subclass works. SF bug #665835.
* Squashed compiler wng about signed/unsigned clash in comparison.Tim Peters2003-02-101-1/+1
|
* Change filterstring() and filterunicode(): If theWalter Dörwald2003-02-101-43/+48
| | | | | | | | | | | | object is not a real str or unicode but an instance of a subclass, construct the output via looping over __getitem__. This guarantees that the result is the same for function==None and function==lambda x:x This doesn't happen for tuples, because filtertuple() uses PyTuple_GetItem(). (This was discussed on SF bug #665835).
* My previous checkin caused compile() to no longer accept buffers, as notedJust van Rossum2003-02-101-5/+7
| | | | | my MAL. Fixed. (Btw. eval() still doesn't take buffers, but that was so even before my patch.)
* patch #683515: "Add unicode support to compile(), eval() and exec"Just van Rossum2003-02-103-9/+56
| | | | Incorporated nnorwitz's comment re. Py__USING_UNICODE.
* Small function call optimization and special build option for call stats.Jeremy Hylton2003-02-053-14/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | -DCALL_PROFILE: Count the number of function calls executed. When this symbol is defined, the ceval mainloop and helper functions count the number of function calls made. It keeps detailed statistics about what kind of object was called and whether the call hit any of the special fast paths in the code. Optimization: When we take the fast_function() path, which seems to be taken for most function calls, and there is minimal frame setup to do, avoid call PyEval_EvalCodeEx(). The eval code ex function does a lot of work to handle keywords args and star args, free variables, generators, etc. The inlined version simply allocates the frame and copies the arguments values into the frame. The optimization gets a little help from compile.c which adds a CO_NOFREE flag to code objects that don't have free variables or cell variables. This change allows fast_function() to get into the fast path with fewer tests. I measure a couple of percent speedup in pystone with this change, but there's surely more that can be done.
* If a float is passed where a int is expected, issue a DeprecationWarningNeil Schemenauer2003-02-041-12/+25
| | | | instead of raising a TypeError. Closes #660144 (again).
* Make sure filter() never returns tuple, str or unicodeWalter Dörwald2003-02-041-5/+22
| | | | subclasses. (Discussed in SF patch #665835)
* PyUnicode_Resize() doesn't free its argument in case of a failure,Walter Dörwald2003-02-041-1/+1
| | | | | so we can jump to the error handling code that does. (Spotted by Neal Norwitz)