summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Revert the previous enhancement to the bytecode optimizer.Raymond Hettinger2003-04-242-86/+9
| | | | The additional code complexity and new NOP opcode were not worth it.
* some more error-message enhancementsAlex Martelli2003-04-231-10/+10
|
* complete and clarify some error messages for range()Alex Martelli2003-04-231-5/+5
|
* PyGILState cleanup was too early - destructors called via module cleanup may ↵Mark Hammond2003-04-221-5/+5
| | | | use the API.
* fixed a potential refcount bug (thanks Raymond!).Alex Martelli2003-04-221-1/+1
|
* Adding new built-in function sum, with docs and tests.Alex Martelli2003-04-221-0/+61
|
* Improved the bytecode optimizer.Raymond Hettinger2003-04-222-9/+86
| | | | | | | | | | | | | | * Can now test for basic blocks. * Optimize inverted comparisions. * Optimize unary_not followed by a conditional jump. * Added a new opcode, NOP, to keep code size constant. * Applied NOP to previous transformations where appropriate. Note, the NOP would not be necessary if other functions were added to re-target jump addresses and update the co_lnotab mapping. That would yield slightly faster and cleaner bytecode at the expense of optimizer simplicity and of keeping it decoupled from the line-numbering structure.
* handle_system_exit(): This leaked the current exception info, inTim Peters2003-04-191-4/+16
| | | | | | | particular leaving the traceback object (and everything reachable from it) alive throughout shutdown. The patch is mostly from Guido. Bugfix candidate.
* New PyGILState_ API - implements pep 311, from patch 684256.Mark Hammond2003-04-195-81/+265
|
* Patch #716969: Detect thread creation failure. Will backport to 2.2.Martin v. Löwis2003-04-192-9/+9
|
* Patch #711835: Remove unnecessary lock operations. Will backport to 2.2.Martin v. Löwis2003-04-181-8/+4
|
* Roll back changes to 'h' format code -- too much breaks. OtherGuido van Rossum2003-04-181-5/+5
| | | | changes stay.
* dded missing k and K format specifiers to Py_BuildValue and friends.Jack Jansen2003-04-171-0/+6
|
* Oops, 'k' is the new format code for un unchecked 32 bit quantity,Jack Jansen2003-04-171-2/+2
| | | | not 'K'.
* Converted manually written code to the new K format specifier.Jack Jansen2003-04-171-2/+2
| | | | Untested, but at least it still compiles.
* _Py_PrintReferences(): Changed to print object address at start of eachTim Peters2003-04-171-2/+9
| | | | | | | | | | | | | | | new line. New pvt API function _Py_PrintReferenceAddresses(): Prints only the addresses and refcnts of the live objects. This is always safe to call, because it has no dependence on Python's C API. Py_Finalize(): If envar PYTHONDUMPREFS is set, call (the new) _Py_PrintReferenceAddresses() right before dumping final pymalloc stats. We can't print the reprs of the objects here because too much of the interpreter has been shut down. You need to correlate the addresses displayed here with the object reprs printed by the earlier PYTHONDUMPREFS call to _Py_PrintReferences().
* SF # 595026: support for masks in getargs.c.Thomas Heller2003-04-171-27/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New functions: unsigned long PyInt_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); unsigned long PyLong_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); New and changed format codes: b unsigned char 0..UCHAR_MAX B unsigned char none ** h unsigned short 0..USHRT_MAX H unsigned short none ** i int INT_MIN..INT_MAX I * unsigned int 0..UINT_MAX l long LONG_MIN..LONG_MAX k * unsigned long none L long long LLONG_MIN..LLONG_MAX K * unsigned long long none Notes: * New format codes. ** Changed from previous "range-and-a-half" to "none"; the range-and-a-half checking wasn't particularly useful. New test test_getargs2.py, to verify all this.
* - New C API PyGC_Collect(), same as calling gc.collect().Guido van Rossum2003-04-171-0/+8
| | | | | - Call this in Py_Finalize(). - Expand the Misc/NEWS text on PY_LONG_LONG.
* A missing piece of the PEP 269 patch: add PyParser_SetError(), aGuido van Rossum2003-04-171-0/+9
| | | | wrapper around err_input().
* Trimmed trailing whitespace.Tim Peters2003-04-171-10/+10
|
* Py_Finalize(): Reverted recent changes that tried to move theTim Peters2003-04-171-8/+11
| | | | | | | | PYTHONDUMPREFS output after most teardown. Attempts to use PYTHONDUMPREFS with the Zope3 test suite died with Py_FatalError(), since _Py_PrintReferences() can end up executing arbitrary Python code (for objects that override __repr__), and that requires an intact interpreter.
* - pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences()Guido van Rossum2003-04-152-13/+17
| | | | | | | | | | | | | | | | | | | even farther down, to just before the call to _PyObject_DebugMallocStats(). This required the following changes: - pystate.c, PyThreadState_GetDict(): changed not to raise an exception or issue a fatal error when no current thread state is available, but simply return NULL without raising an exception (ever). - object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL, don't raise an exception but return 0. This means that when printing a container that's recursive, printing will go on and on and on. But that shouldn't happen in the case we care about (see first bullet). - Updated Misc/NEWS and Doc/api/init.tex to reflect changes to PyThreadState_GetDict() definition.
* Move the call to _Py_PrintReferences() a bit further down. ThisGuido van Rossum2003-04-151-7/+12
| | | | | prevents it from showing stuff (like codec state) that is cleared when the interpreter state is cleared.
* 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.