summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Fixed order of parameters in slice() docstring. The Library ReferenceFred Drake1999-07-191-1/+1
| | | | had it right! Reported by Tim Hochberg <tim.hochberg@ieee.org>.
* Marc-Andre Lemburg discovered that the switch from .pyc to .pyo files,Guido van Rossum1999-07-081-2/+2
| | | | | done by _PyImport_Init(), comes to late to affect the import of exceptions.py by _PyBuiltin_Init_2(). Move _PyImport_Init() up few lines.
* Patch by Tim Peters:Guido van Rossum1999-06-222-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new builtin exception, UnboundLocalError, raised when ceval.c tries to retrieve or delete a local name that isn't bound to a value. Currently raises NameError, which makes this behavior a FAQ since the same error is raised for "missing" global names too: when the user has a global of the same name as the unbound local, NameError makes no sense to them. Even in the absence of shadowing, knowing whether a bogus name is local or global is a real aid to quick understanding. Example: D:\src\PCbuild>type local.py x = 42 def f(): print x x = 13 return x f() D:\src\PCbuild>python local.py Traceback (innermost last): File "local.py", line 8, in ? f() File "local.py", line 4, in f print x UnboundLocalError: x D:\src\PCbuild> Note that UnboundLocalError is a subclass of NameError, for compatibility with existing class-exception code that may be trying to catch this as a NameError. Unfortunately, I see no way to make this wholly compatible with -X (see comments in bltinmodule.c): under -X, [UnboundLocalError is an alias for NameError --GvR]. [The ceval.c patch differs slightly from the second version that Tim submitted; I decided not to raise UnboundLocalError for DELETE_NAME, only for DELETE_LOCAL. DELETE_NAME is only generated at the module level, and since at that level a NameError is raised for referencing an undefined name, it should also be raised for deleting one.]
* CRITICAL PATCH!Guido van Rossum1999-06-181-5/+23
| | | | | | | | | | | | | | We occasionally received reports from people getting "invalid tstate" crashes (this is a fatal error in PyThreadState_Delete()). Finally several people were able to reproduce it reliably and Tim Peters discovered that there is a race condition when multiple threads are calling this function without holding the global interpreter lock (the function may be called without holding that). Solved the race condition by adding a lock around the mutating uses of interp->tstate_head. Tim and Jonathan Giddy have run tests that make it likely that this fixes the crashes -- although Tim hasn't heard from the person who reported the original problem.
* # Darn! Local variable l declared but not used in abstract_issubclass().Guido van Rossum1999-06-171-1/+1
|
* Patch by Jim Fulton (code style tweaked a bit) to supportGuido van Rossum1999-06-161-17/+94
| | | | | | | | | | | | | | | | ExtensionClasses in isinstance() and issubclass(). - abstract instance and class protocols are used *only* in those cases that would generate errors before the patch. That is, there's no penalty for the normal case. - instance protocol: an object smells like an instance if it has a __class__ attribute that smells like a class. - class protocol: an object smells like a class if it has a __bases__ attribute that is a tuple with elements that smell like classes (although not all elements may actually get sniffed ;).
* Allow longer strings (up to 80 chars each) for version, build,Guido van Rossum1999-04-221-2/+2
| | | | compiler info.
* Patch by Christian Tismer for Win32, to use FormatMessage() instead ofGuido van Rossum1999-04-211-2/+29
| | | | strerror(). This improves the quality of the error messages.
* While I can't really test this thoroughly, Pat Knight and the SolarisGuido van Rossum1999-04-131-1/+2
| | | | | | man pages suggest that the proper thing to do is to add THR_NEW_LWP to the flags on thr_create(), and that there really isn't a downside, so I'll do that.
* Win/CE thread support by Mark Hammond.Guido van Rossum1999-04-081-0/+201
|
* Alas, get rid of the Win specific hack to ask the user to press ReturnGuido van Rossum1999-04-071-47/+0
| | | | | before exiting when an error happened. This didn't work right when Python is invoked from a daemon.
* Changes by Mark Hammond for Windows CE. Mostly of the formGuido van Rossum1999-04-075-0/+18
| | | | #ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
* Remove unused variable from complex_from_string() code.Guido van Rossum1999-04-071-1/+1
|
* Patch by Nick and Stephanie Lockwood to implement complex() with a stringGuido van Rossum1999-03-251-4/+133
| | | | argument. This closes TODO item 2.19.
* New builtin buffer() creates a derived read-only buffer from anyGuido van Rossum1999-03-191-0/+24
| | | | object that supports the buffer interface (e.g. strings, arrays).
* Rob Riggs wrote:Guido van Rossum1999-03-151-2/+2
| | | | | | | | | | | | | | | """ Spec says that on success pthread_create returns 0. It does not say that an error code will be < 0. Linux glibc2 pthread_create() returns ENOMEM (12) when one exceed process limits. (It looks like it should return EAGAIN, but that's another story.) For reference, see: http://www.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html """ [I have a feeling that similar bugs were fixed before; perhaps someone could check that all error checks no check for != 0?]
* Always test for an error return (usually NULL or -1) without settingGuido van Rossum1999-03-091-3/+4
| | | | an exception.
* (initerrors): Make sure that the exception tuples ("base-classes" whenBarry Warsaw1999-02-241-8/+18
| | | | | string-based exceptions are used) reflect the real class hierarchy, i.e. that SystemExit derives from Exception not StandardError.
* Patch by Tim Peters to improve the range checks for range() andGuido van Rossum1999-02-231-30/+48
| | | | | | | xrange(), especially for platforms where int and long are different sizes (so sys.maxint isn't actually the theoretical limit for the length of a list, but the largest C int is -- sys.maxint is the largest Python int, which is actually a C long).
* Patch by Tommy Burnette to accept an arbitrary sequence when "(...)"Guido van Rossum1999-02-171-7/+10
| | | | | is used in the format string, instead of requiring a tuple. This is in line with the general trend towards accepting arbitrary sequences.
* initmain(): Nailed a memory leak. bimod must be DECREF'd!Barry Warsaw1999-01-291-0/+1
|
* bltin_exc[]: EnvironmentError is not a "leaf exception", so set it'sBarry Warsaw1999-01-291-1/+1
| | | | leaf_exc flag to zero otherwise the name leaks memory.
* builtin_map(): A better fix for the previous leak plug (rememberBarry Warsaw1999-01-281-3/+6
| | | | | | PyList_Append steals a reference even if it fails). builtin_filter(): Had the same leak problem as builtin_map().
* Implement -OO; "unsafe" optimization that removes docstrings.Guido van Rossum1999-01-281-0/+3
| | | | Marc-Andre Lemburg.
* builtin_map(): Nailed memory leak. PyList_Append() borrows aBarry Warsaw1999-01-281-0/+1
| | | | | reference, so you have to DECREF the appended value. This was a fun one!
* builtin_complex(): Nailed memory leak. This one's in the instanceBarry Warsaw1999-01-271-0/+1
| | | | | | test for classes with a __complex__() method. The attribute is pulled out of the instance with PyObject_GetAttr() but this transfers ownership and the function object was never DECREF'd.
* PyImport_ReloadModule(): Nailed a small memory leak. In theBarry Warsaw1999-01-271-0/+1
| | | | | else-clause of the subname test, the parentname object was never DECREF'd.
* Patches by William Lewis for Nextstep descendants.Guido van Rossum1999-01-273-11/+74
|
* err_input(): Nailed a small memory leak. If the error is E_INTR, theBarry Warsaw1999-01-271-1/+2
| | | | | | | | | v temporary variable was never decref'd. Test this by starting up the interpreter, hitting C-c, then immediately exiting. Same potential leak can occur if error is E_NOMEM, since the return is done in the case block. Added Py_XDECREF(v); to both blocks, just before the return.
* _PySys_Init(): Nailed small memory leak. The stringobject created forBarry Warsaw1999-01-271-0/+1
| | | | sys.version was missing a Py_XDECREF().
* Change rare occurrences of #if HAVE_LONG_LONG to #ifdef.Guido van Rossum1999-01-252-3/+3
|
* Jim Ahlstrom patch: the module doc string is too long for 16-bit VCGuido van Rossum1999-01-141-1/+5
| | | | 1.5. Omit the second part.
* Avoid overflow if possible in calculations for range(); reportGuido van Rossum1999-01-121-7/+28
| | | | unavoidable overflow as OverflowError.
* Hack for Windows so that if (1) the exit status is nonzero and (2) weGuido van Rossum1999-01-081-0/+47
| | | | | | | | | think we have our own DOS box (i.e. we're not started from a command line shell), we print a message and wait for the user to hit a key before the DOS box is closed. The hacky heuristic for determining whether we have our *own* DOS box (due to Mark Hammond) is to test whether we're on line zero...
* Ty Sarna writes:Guido van Rossum1999-01-071-1/+1
| | | | | | | | | The following patches (relative to 1.5.2b1) enable Python dynamic loading to work on NetBSD platforms that use ELF (presnetly mips and alpha systems). They automaticly determine wether the system is ELF or a.out rather than using astatic list of platforms so that when other NetBSD platforms move to ELF, python will continue to work without change.
* Chris Herborth writes:Guido van Rossum1999-01-041-38/+4
| | | | Donn Cave tells me the PyImport_BeImageID() function isn't needed anymore.
* Add sys.hexversion, which is an integer encoding the version in hexadecimal.Guido van Rossum1999-01-031-0/+2
| | | | | | In other words, hex(sys.hexversion) == 0x010502b2 for Python 1.5.2b2. This is derived from the new variable PY_VERSION_HEX defined in patchlevel.h. (Cute, eh?)
* Use PY_VERSION instead of PATCHLEVEL.Guido van Rossum1999-01-031-1/+2
|
* Call PyInitFrozenExtensions() as requested by Mark Hammond (his patch).Guido van Rossum1999-01-021-0/+4
|
* Oops, forgot a pair of {}'s. (Greg Couch)Guido van Rossum1998-12-231-1/+2
|
* Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF.Guido van Rossum1998-12-231-1/+3
| | | | Patch and suggestion by Greg Couch.
* Improve comment for PyImport_Import() as suggested by Bill Tutt.Guido van Rossum1998-12-211-1/+4
|
* Thanks to Chris Herborth, the thread primitives now have proper Py*Guido van Rossum1998-12-2113-412/+412
| | | | | names in the source code (they already had those for the linker, through some smart macros; but the source still had the old, un-Py names).
* Use PyThreadState_GET() macro.Guido van Rossum1998-12-212-2/+2
|
* Make current_tstate a global, _PyThreadState_Current. This is toGuido van Rossum1998-12-211-10/+10
| | | | support a macro in pystate.h.
* Chris H. writes:Guido van Rossum1998-12-181-1/+1
| | | | | If we're going to put the PyOS_strtol() proto in intobject.h we should include it here or the symbol isn't exported on PowerPC.
* Patch by Chris Herborth:Guido van Rossum1998-12-171-0/+4
| | | | have to use a const-correct prototype on BeOS or the compiler gets uppity.
* Move the prototype for dump_counts() to before where it is used.Guido van Rossum1998-12-151-4/+4
| | | | (This only applies when COUNT_ALLOCS is defined.)
* Remove prototypes for PyOS_strto[u]l -- Chris Herborth.Guido van Rossum1998-12-101-3/+0
|
* Add more SET_LINENO instructions in long argument listsGuido van Rossum1998-12-101-1/+7
|