summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Create two new exceptions: IndentationError and TabError. These areFred Drake2000-07-112-4/+42
| | | | | | | used for indentation related errors. This patch includes Ping's improvements for indentation-related error messages. Closes SourceForge patches #100734 and #100856.
* Exception__str__(): In case 1, be sure to decref the tmp localBarry Warsaw2000-07-091-4/+8
| | | | | variable. This crushes another memory leak. Slight rewrite included.
* EnvironmentError__init__(): The two case clauses were missingBarry Warsaw2000-07-091-3/+9
| | | | | | | | `break's. This first missing break caused a memory leak when case 3 fell through case 2 in the following example: import os os.chmod('/missing', 0600)
* Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters2000-07-0911-135/+126
|
* Get rid of unused vars in builtin_unicode (they were causingTim Peters2000-07-091-2/+0
| | | | legit warnings).
* Fixed unicode() to use the new API PyUnicode_FromEncodedObject().Marc-André Lemburg2000-07-071-14/+1
| | | | | | | This adds support for instance to the constructor (instances have to define __str__ and can return Unicode objects via that hook; string return values are decoded into Unicode using the current default encoding).
* Added support for H (unsigned short) specifier in PyArg_ParseTuple andJack Jansen2000-07-062-1/+30
| | | | Py_BuildValue.
* Include limits.h if we have it.Jack Jansen2000-07-034-0/+12
|
* init_exceptions(): Decref `doc' so it doesn't leak.Barry Warsaw2000-07-011-0/+1
|
* Jack Jansen, Mac patch:Guido van Rossum2000-07-011-0/+3
| | | | Include limits.h if we have it.
* Jack Jansen, Mac patch:Guido van Rossum2000-07-011-0/+6
| | | | If we have stat.h include it if we don't have sys/stat.h
* Jack Jansen, Mac patch:Guido van Rossum2000-07-011-2/+3
| | | | Include stat.h if needed; different Mac filename compare
* Change copyright notice - 2nd try.Guido van Rossum2000-06-3049-294/+0
|
* Change copyright notice.Guido van Rossum2000-06-3051-1112/+347
|
* Trent Mick <trentm@activestate.com>:Fred Drake2000-06-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The common technique for printing out a pointer has been to cast to a long and use the "%lx" printf modifier. This is incorrect on Win64 where casting to a long truncates the pointer. The "%p" formatter should be used instead. The problem as stated by Tim: > Unfortunately, the C committee refused to define what %p conversion "looks > like" -- they explicitly allowed it to be implementation-defined. Older > versions of Microsoft C even stuck a colon in the middle of the address (in > the days of segment+offset addressing)! The result is that the hex value of a pointer will maybe/maybe not have a 0x prepended to it. Notes on the patch: There are two main classes of changes: - in the various repr() functions that print out pointers - debugging printf's in the various thread_*.h files (these are why the patch is large) Closes SourceForge patch #100505.
* Trent Mick <trentm@activestate.com>:Fred Drake2000-06-302-14/+33
| | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes possible overflow in the use of PyOS_GetLastModificationTime in getmtime.c and Python/import.c. Currently PyOS_GetLastModificationTime returns a C long. This can overflow on Win64 where sizeof(time_t) > sizeof(long). Besides it should logically return a time_t anyway (this patch changes this). As well, import.c uses PyOS_GetLastModificationTime for .pyc timestamping. There has been recent discussion about the .pyc header format on python-dev. This patch adds oveflow checking to import.c so that an exception will be raised if the modification time overflows. There are a few other minor 64-bit readiness changes made to the module as well: - size_t instead of int or long for function-local buffer and string length variables - one buffer overflow check was added (raises an exception on possible overflow, this overflow chance exists on 32-bit platforms as well), no other possible buffer overflows existed (from my analysis anyway) Closes SourceForge patch #100509.
* Trent Mick <trentm@activestate.com>:Fred Drake2000-06-3011-110/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | The common technique for printing out a pointer has been to cast to a long and use the "%lx" printf modifier. This is incorrect on Win64 where casting to a long truncates the pointer. The "%p" formatter should be used instead. The problem as stated by Tim: > Unfortunately, the C committee refused to define what %p conversion "looks > like" -- they explicitly allowed it to be implementation-defined. Older > versions of Microsoft C even stuck a colon in the middle of the address (in > the days of segment+offset addressing)! The result is that the hex value of a pointer will maybe/maybe not have a 0x prepended to it. Notes on the patch: There are two main classes of changes: - in the various repr() functions that print out pointers - debugging printf's in the various thread_*.h files (these are why the patch is large) Closes SourceForge patch #100505.
* replace constant 1 with symbolic constant METH_VARARGSJeremy Hylton2000-06-301-9/+9
| | | | another typo caught by Rob Hooft
* another typo caught by Rob HooftJeremy Hylton2000-06-301-1/+1
|
* - workaround to make 1.6 build under MSVC 5.0. hopefully,Fredrik Lundh2000-06-291-0/+4
| | | | | trent (who broke it in the first place ;-) will come up with a cleaner solution.
* Change the loop index in normalizestring() to size_t too, to avoid aGuido van Rossum2000-06-291-1/+1
| | | | warning on Windows.
* Vladimir Marangozov:Guido van Rossum2000-06-281-8/+8
| | | | | | | | | | | | This patch fixes a problem on AIX with the signed int case code in getargs.c, after Trent Mick's intervention about MIN/MAX overflow checks. The AIX compiler/optimizer generates bogus code with the default flags "-g -O" causing test_builtin to fail: int("10", 16) <> 16L. Swapping the two checks in the signed int code makes the problem go away. Also, make the error messages fit in 80 char lines in the source.
* Urmpf. Quality control on this patch lapsed a bit. :-(Guido van Rossum2000-06-281-2/+6
| | | | | | | | | | | The depth field was never decremented inside w_object(), and it was never initialized in PyMarshal_WriteObjectToFile(). This caused imports from .pyc files to fil mysteriously when the .pyc file was written by the broken code -- w_object() would bail out early, but PyMarshal_WriteObjectToFile() doesn't check the error or return an error code, and apparently the marshalling code doesn't call PyErr_Check() either. (That's a separate patch if I feel like it.)
* Trent Mick's Win64 changes: size_t vs. int or long; also some overflowGuido van Rossum2000-06-289-21/+40
| | | | tests.
* Trent Mick:Guido van Rossum2000-06-281-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | Various small fixes to the builtin module to ensure no buffer overflows. - chunk #1: Proper casting to ensure no truncation, and hence no surprises, in the comparison. - chunk #2: The id() function guarantees a unique return value for different objects. It does this by returning the pointer to the object. By returning a PyInt, on Win64 (sizeof(long) < sizeof(void*)) the pointer is truncated and the guarantee may be proven false. The appropriate return function is PyLong_FromVoidPtr, this returns a PyLong if that is necessary to return the pointer without truncation. [GvR: note that this means that id() can now return a long on Win32 platforms. This *might* break some code...] - chunk #3: Ensure no overflow in raw_input(). Granted the user would have to pass in >2GB of data but it *is* a possible buffer overflow condition.
* Michael Hudson <mwh21@cam.ac.uk>:Fred Drake2000-06-281-3/+22
| | | | | | | | | | | | | As I really do not have anything better to do at the moment, I have written a patch to Python/marshal.c that prevents Python dumping core when trying to marshal stack bustingly deep (or recursive) data structure. It just throws an exception; even slightly clever handling of recursive data is what pickle is for... [Fred Drake:] Moved magic constant 5000 to a #define. This closes SourceForge patch #100645.
* Add new parser error code, E_OVERFLOW. This error is returned whenJeremy Hylton2000-06-201-0/+3
| | | | | | the number of children of a node exceeds the max possible value for the short that is used to count them. The Python runtime converts this parser error into the SyntaxError "expression too long."
* mark SyntaxError__str__ as METH_VARARGSJeremy Hylton2000-06-201-1/+1
|
* Added a new debug method sys.gettotalrefcount(), which returns the total ↵Mark Hammond2000-06-201-1/+14
| | | | | | number of references on all Python objects. This is only enabled when Py_TRACE_REFS is defined (which includes default debug builds under Windows). Also removed a redundant cast from sys.getrefcount(), as discussed on the patches list.
* Christopher Fandrich <cfandrich@8cs.com>:Fred Drake2000-06-201-3/+6
| | | | Fix memory leak in initializing __debug__.
* Marc-Andre Lemburg <mal@lemburg.com>:Marc-André Lemburg2000-06-071-10/+10
| | | | | | Changed the API names for setting the default encoding. These are now in line with the other hooks API names (no underscores).
* The standard exception classes. Moved here from ../Modules/_exceptions.cBarry Warsaw2000-05-261-0/+994
|
* Added exceptions.o to the list of object to build in this subdir.Barry Warsaw2000-05-261-1/+2
|
* All the exception building related stuff has been moved out of thisBarry Warsaw2000-05-251-190/+1
| | | | | | | | | | | | module and into _exceptions.c. This includes all the PyExc_* globals, the bltin_exc table, init_class_exc(), fini_instances(), finierrors(). Renamed _PyBuiltin_Init_1() to _PyBuiltin_Init() since the two phase initializations are necessary any more. Removed as obsolete _PyBuiltin_Init_2(), _PyBuiltin_Fini_1() and _PyBuiltin_Fini_2().
* Py_Initialize(): Now that standard exceptions are builtin, we don'tBarry Warsaw2000-05-251-11/+11
| | | | | | | | | | need two phase init or fini of the builtin module. Change the call of _PyBuiltin_Init_1() to _PyBuiltin_Init(). Add a call to init_exceptions(). Py_Finalize(): Don't call _PyBuiltin_Fini_1(). Instead call fini_exceptions() but move this to before the thread state is cleared.
* bltin_exc: Removed the leaf_exc flag in the structure, which was onlyBarry Warsaw2000-05-251-35/+29
| | | | used to build the fallback string-based exception.
* Bill Tutt:Guido van Rossum2000-05-111-1/+24
| | | | | Calling Sleep(0) for a spinlock can cause a priority inversion, adding comments to explain what's going on.
* At Bob Kahn's request, add CNRI to the copyright string (but not toGuido van Rossum2000-05-101-1/+5
| | | | the notice yet).
* Trent Mick <trentm@activestate.com>:Fred Drake2000-05-091-12/+12
| | | | | | Limit the 'b' formatter of PyArg_ParseTuple to valid values of an unsigned char, i.e. [0,UCHAR_MAX]. It is expected that this is the common usage of 'b'. An OverflowError is raised if the parsed value is outside this range.
* M.-A. Lemburg <mal@lemburg.com>:Fred Drake2000-05-091-0/+37
| | | | | | Added APIs to allow setting and querying the system's current string encoding: sys.set_string_encoding() and sys.get_string_encoding().
* M.-A. Lemburg <mal@lemburg.com>:Fred Drake2000-05-091-9/+5
| | | | | | | Moved some docs to the include file. Added a NULL check to _PyCodec_Lookup() to make it core dump safe.
* M.-A. Lemburg <mal@lemburg.com>:Fred Drake2000-05-091-2/+2
| | | | | Fixed docs according to the new behaviour (the Unicode encoding is no longer fixed to UTF-8).
* Trent Mick:Guido van Rossum2000-05-081-11/+14
| | | | | Change static slice_index() to extern _PyEval_SliceIndex() (with different return value interpretation: 0 for failure, 1 for success).
* Trent Mick:Guido van Rossum2000-05-081-14/+44
| | | | | | | | | | Changes the 'b', 'h', and 'i' formatters in PyArg_ParseTuple to raise an Overflow exception if they overflow (previously they just silently overflowed). Changes by Guido: always accept values [0..255] (in addition to [CHAR_MIN..CHAR_MAX]) for 'b' format; changed some spaces into tabs in other code.
* Andy Dustman: add GNU pth user-space thread support.Guido van Rossum2000-05-082-0/+332
|
* Quick fix by Mark Hammond -- Yakov changed a dprintf call but it wasGuido van Rossum2000-05-051-1/+1
| | | | referencing an undefined variable, so we better change it back.
* Fast NonRecursiveMutex support by Yakov Markovitch, markovitch@iso.ru,Guido van Rossum2000-05-041-25/+113
| | | | | | | | | | | | | | | | | | who wrote: Here's the new version of thread_nt.h. More particular, there is a new version of thread lock that uses kernel object (e.g. semaphore) only in case of contention; in other case it simply uses interlocked functions, which are faster by the order of magnitude. It doesn't make much difference without threads present, but as soon as thread machinery initialised and (mostly) the interpreter global lock is on, difference becomes tremendous. I've included a small script, which initialises threads and launches pystone. With original thread_nt.h, Pystone results with initialised threads are twofold worse then w/o threads. With the new version, only 10% worse. I have used this patch for about 6 months (with threaded and non-threaded applications). It works remarkably well (though I'd desperately prefer Python was free-threaded; I hope, it will soon).
* Add useless 'return 1' to prtrace() to shut up VC++.Guido van Rossum2000-05-041-0/+1
|
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-037-19/+18
| | | | | | | | | | For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
* A bit of cleanup:Guido van Rossum2000-05-031-34/+5
| | | | | | | | | - When 'import exceptions' fails, don't suggest to use -v to print the traceback; this doesn't actually work. - Remove comment about fallback to string exceptions. - Remove a PyErr_Occurred() check after all is said and done that can never trigger. - Remove static function newstdexception() which is no longer called.