summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* PyModule_AddObject(): Added missing exceptions.Fred Drake2002-06-171-7/+14
| | | | Closes SF bug #523473.
* Fix SF #561858 Assertion with very long listsNeal Norwitz2002-06-011-0/+15
| | | | | | | | | | | | | | if co_stacksize was > 32767 (the maximum value which can be stored in 16 bits (signed)), the PyCodeObject would be written wrong. So on the second import (reading the .pyc) would cause a crash. Since we can't change the PYC magic, we go on (silently), but don't write the file. This means everything will work, but a .pyc will not be written and the file will need to be parsed on each import.
* backport tim_one's patch:Anthony Baxter2002-04-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Original patch(es): python/dist/src/Python/bltinmodule.c:2.253
* Backport fixes for two nested scopes bugs.Jeremy Hylton2002-04-202-1/+12
| | | | | | | | | | | | frameobject.c: make sure free and cell vars make it into locals, which makes eval work. bltinmodule.c & ceval.c: make sure a code object with free variables that is passed to exec or eval raises an exception. Also duplicate the current trunk test suite in the 2.1 branch, except for certain necessary changes: different warnings raised by 2.1, need for __future__.
* Backport for 2.1.3 (if we ever release it; we may have to becauseGuido van Rossum2002-03-281-2/+10
| | | | | | | | | | | | | | | | this is what Zope 2 will be using in the foreseeable future). Fix an issue that was reported in but unrelated to the main problem of 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!
* Backport revision 2.69.Guido van Rossum2002-01-151-2/+3
| | | | | | | | | | | | | | | | | | | SF patch #471839: Bug when extensions import extensions (Shane Hathaway) When an extension imports another extension in its initXXX() function, the variable _Py_PackageContext is prematurely reset to NULL. If the outer extension then calls Py_InitModule(), the extension is installed in sys.modules without its package name. The manifestation of this bug is a "SystemError: _PyImport_FixupExtension: module <package>.<extension> not loaded". To fix this, importdl.c just needs to retain the old value of _Py_PackageContext and restore it after the initXXX() method is called. The attached patch does this. This patch applies to Python 2.1.1 and the current CVS.
* Attempted to update all the copyright notices (we're releasing this inTim Peters2002-01-101-1/+1
| | | | 2002!). Does anyone know of a copyright blurb I missed?
* cosmetic change to add a commit message for the last commit, accidentlyAnthony Baxter2002-01-101-1/+1
| | | | | | | | sent with empty message. sheesh. Lucky I decided it was worth doing last minute complete compile tests. cvs merge stupid on my part fixed that made solaris builds totally fail.
* thread_pthread.hAnthony Baxter2002-01-101-1/+1
|
* backport of solaris thread patch, adding PTHREAD_SCOPE_SYSTEM support:Anthony Baxter2001-12-231-0/+11
| | | | | | | | | | | | | | Improve threading on Solaris, according to SF patch #460269, submitted by bbrox@bbrox.org / lionel.ulmer@free.fr. This adds a configure check and if all goes well turns on the PTHREAD_SCOPE_SYSTEM thread attribute for new threads. This should remove the need to add tiny sleeps at the start of threads to allow other threads to be scheduled. This is a semi-feature, but makes such a huge difference to the performance of Zope on Solaris that it's worthwhile (well, imho).
* backport 2.35:Anthony Baxter2001-12-211-3/+3
| | | | | | | | SF bug 485175: buffer overflow in traceback.c. Bugfix candidate. tb_displayline(): the sprintf format was choking off the file name, but used plain %s for the function name (which can be arbitrarily long). Limit both to 500 chars max.
* backport 2.153:Anthony Baxter2001-12-211-0/+3
| | | | Missing DECREFs when exception is raised in sys.excepthook.
* backport 2.9:Anthony Baxter2001-12-211-0/+1
| | | | | | | | PySymtableEntry_New(): I'm not sure what this routine is doing, but it was obviously leaking an int object when whatever the heck it's looking for was found. Repaired that. This accounts for why entering function and class definitions at an interactive prompt leaked a reference to the integer 1 each time.
* backport 2.144:Anthony Baxter2001-12-211-0/+1
| | | | | | | | | Py_Initialize(): Apply patch by Jürgen Hermann to call _PyImport_FixupExtension() on the exceptions module. Now reload(exceptions) acts just like reload(sys) instead of raising an ImportError. This closes SF bug #422004.
* Backport rev 2.301 to the 2.1 maintenance branch.Jeremy Hylton2001-12-201-1/+5
| | | | Add checks for stack underflow and overflow.
* backport of jeremy's 2.227:Anthony Baxter2001-11-211-19/+51
| | | | | | | | | | | Fix for SF bug [ #471928 ] global made w/nested list comprehensions . Initially I was going to just rip out the bits of this that fixed this bug, but the rest of the code looks (after a fair amount of staring at it) like it's ok - variable renames, that sort of thing. flames and "hey, no way!" to me, or to python-dev. It felt safer to just go with the full patch, rather than butchering it.
* backport of tim's 2.66:Anthony Baxter2001-11-211-1/+1
| | | | | . SF bug [#467265] Compile errors on SuSe Linux on IBM/s390. - errors.c, PyErr_Format: add a va_end() to balance the va_start().
* backport of 2.8, after checking with MarkHAnthony Baxter2001-11-211-17/+14
| | | | | . Always pass a full path name to LoadLibraryEx(). Fixes some Windows 9x problems. As discussed on python-dev
* backport of patches 2.10, 2.11, 2.12, by MvL.Anthony Baxter2001-11-211-4/+8
| | | | | | | | . Patch #455231: Support ELF properly on OpenBSD. . Patch to bug #472202: Correctly recognize NetBSD before 199712. . Move dlfcn.h block out of NetBSD block, assuming that NetBSD before 199712 didn't have dlfcn.h, or that it wouldn't conflict with the other stuff defined.
* backport of 2.8 by jack:Anthony Baxter2001-11-211-3/+7
| | | | | | | | | Patch by Jonathan Wight (slightly reformatted) to forestall loading the same module twice, which apparently crashes Python. I could not test the error condition, but in normal life it seems to have no adverse effects. Also removed an unsued variable, and corrected 2 glaring errors (missing 'case' in front of a label).
* backport of 2.242:Anthony Baxter2001-11-211-2/+3
| | | | improved error message-- names the type of the unexpected object
* backport of 2.90:Anthony Baxter2001-11-211-0/+5
| | | | | Patch number #422106 by Greg Ball, to fix segmentation fault in sys.displayhook.
* Backport fix from 2.277 - incorrectly swapped arguments to PyFrame_BlockSetup.Anthony Baxter2001-10-211-2/+2
| | | | Fixes very obscure and nasty bug.
* Backport of Tim's checkin 2.178:Thomas Wouters2001-07-111-11/+28
| | | | | | | | | | | SF bug #438295: [Windows] __init__.py cause strange behavior Probable fix (the bug report doesn't have enough info to say for sure). find_init_module(): Insist on a case-sensitive match for __init__ files. Given __INIT__.PY instead, find_init_module() thought that was fine, but the later attempt to do find_module("__INIT__.PY") didn't and its caller silently suppressed the resulting ImportError. Now find_init_module() refuses to accept __INIT__.PY to begin with.
* Backport Tim's checkin 2.247:Thomas Wouters2001-06-271-2/+3
| | | | | | SF bug 433228: repr(list) woes when len(list) big call_object: If the object isn't callable, display its type in the error msg rather than its repr.
* Backport Tim's checkin 2.201:Thomas Wouters2001-06-271-10/+54
| | | | | | | | SF bug 430991: wrong co_lnotab Armin Rigo pointed out that the way the line-# table got built didn't work for lines generating more than 255 bytes of bytecode. Fixed as he suggested, plus corresponding changes to pyassem.py, plus added some long overdue docs about this subtle table to compile.c.
* Backport Jeremy's checkin 2.57:Thomas Wouters2001-06-271-9/+7
| | | | | | vgetargs1() and vgetargskeywords(): Replace uses of PyTuple_Size() and PyTuple_GetItem() with PyTuple_GET_SIZE() and PyTuple_GET_ITEM(). The code has already done a PyTuple_Check().
* Backport Jeremy's checkin 2.244:Thomas Wouters2001-06-271-1/+7
| | | | | | | | Add a second special case to the inline function call code in eval_code2(). If we have a PyCFunction (builtin) and it is METH_VARARGS only, load the args and dispatch to call_cfunction() directly. This provides a small speedup for perhaps the most common function calls -- builtins.
* Backport of Tim's checkin 2.177:Thomas Wouters2001-05-231-8/+5
| | | | | | | | | | | | | | | | | SF bug #417093: Case sensitive import: dir and .py file w/ same name Directory containing Spam.py spam/__init__.py Then "import Spam" caused a SystemError, because code checking for the existence of "Spam/__init__.py" finds it on a case-insensitive filesystem, but then bails because the directory it finds it in doesn't match case, and then old code assumed that was still an error even though it isn't anymore. Changed the code to just continue looking in this case (instead of calling it an error). So import Spam and import spam both work now.
* Backport Tim's checkin 2.199:Thomas Wouters2001-05-231-9/+19
| | | | | | | | | Fix buglet reported on c.l.py: map(fnc, file.xreadlines()) blows up. Took away map()'s insistence that sequences support __len__, and cleaned up the convoluted code that made it *look* like it really cared about __len__ (in fact the old ->len field was only *used* as a flag bit, as the main loop only looked at its sign bit, setting the field to -1 when IndexError got raised; renamed the field to ->saw_IndexError instead).
* Backport Jeremy's checkin 2.198:Thomas Wouters2001-05-231-6/+20
| | | | | | | | | | Fix 2.1 nested scopes crash reported by Evan Simpson The new test case demonstrates the bug. Be more careful in symtable_resolve_free() to add a var to cells or frees only if it won't be added under some other rule. XXX Add new assertion that will catch this bug.
* This commit was manufactured by cvs2svn to create branchcvs2svn2001-04-171-211/+0
| | | | 'release21-maint'.
* Make some private symbols static.Guido van Rossum2001-04-142-3/+4
|
* split long lineJeremy Hylton2001-04-131-1/+2
|
* Change error message raised when free variable is not yet bound. ItJeremy Hylton2001-04-131-10/+16
| | | | | | | | | now raises NameError instead of UnboundLocalError, because the var in question is definitely not local. (This affects test_scope.py) Also update the recent fix by Ping using get_func_name(). Replace tests of get_func_name() return value with call to get_func_desc() to match all the other uses.
* Patch by Ping (SF bug 415879, Exception.__init__() causes segfault):Guido van Rossum2001-04-131-3/+2
| | | | | | | | | | | | Calling an unbound method on a C extension class without providing an instance can yield a segfault. Try "Exception.__init__()" or "ValueError.__init__()". This is a simple fix. The error-reporting bits in call_method mistakenly treat the misleadingly-named variable "func" as a function, when in fact it is a method. If we let get_func_name take care of the work, all is fine.
* Because this code was derived from Python 1.6.1 (amongst others), theGuido van Rossum2001-04-121-1/+1
| | | | CNRI copyright should be updated to include 2001.
* Update copyright to PSF.Guido van Rossum2001-04-121-1/+1
|
* Fix exception handling for non-PyFunction objects, SF bug 414743.Jeremy Hylton2001-04-111-16/+54
| | | | | | | | Fix based on patch #414750 by Michael Hudson. New functions get_func_name() and get_func_desc() return reasonable names and descriptions for all objects. XXX Even objects that aren't actually callable.
* Updated version of RISCOS support. SF patch 411213 by Dietmar SchwertbergerGuido van Rossum2001-04-101-0/+4
|
* test_pickle works on sizeof(long)==8 boxes again.Tim Peters2001-04-101-1/+1
| | | | | | | | | | pickle.py The code implicitly assumed that all ints fit in 4 bytes, causing all sorts of mischief (from nonsense results to corrupted pickles). Repaired that. marshal.c The int marshaling code assumed that right shifts of signed longs sign-extend. Repaired that.
* Warn when assigning to __debug__ instead of raising an error.Jeremy Hylton2001-04-091-7/+2
|
* SF patch #413552 - Premature decref on objectTim Peters2001-04-071-3/+7
| | | | | | | | | Jeffery Collins pointed out that filterstring decrefs a character object before it's done using it. This works by accident today because another module always happens to have an active reference too at the time. The accident doesn't work after his Pippy modifications, and since it *is* an accident even in the mainline Python, it should work by design there too. The patch accomplishes that.
* Bug fix: compile() called from a nested-scopes-enable Python was notJeremy Hylton2001-03-261-1/+1
| | | | | using nested scopes to compile its argument. Pass compiler flags through to underlying compile call.
* Finishing touch to Ping's changes. This is a patch that Ping sent meGuido van Rossum2001-03-231-11/+11
| | | | | | | | but apparently he had to go to school, so I am checking it in for him. This makes PyRun_HandleSystemExit() a static instead, called handle_system_exit(), and let it use the current exception rather than passing in an exception. This slightly simplifies the code.
* call_sys_exitfunc(): Remove unused variable f.Fred Drake2001-03-231-1/+1
|
* Allow sys.excepthook and sys.exitfunc to quietly exit with a sys.exit().Ka-Ping Yee2001-03-231-32/+37
| | | | sys.exitfunc gets the last word on the exit status of the program.
* Make it illegal to assign to __debug__ as per Guido's request.Jeremy Hylton2001-03-231-1/+12
|
* Fix memory leak with SyntaxError. (The DECREF was originally hiddenGuido van Rossum2001-03-231-0/+1
| | | | | inside a piece of code that was deemed reduntant; the DECREF was unfortunately *not* redundant!)
* Add sys.excepthook.Ka-Ping Yee2001-03-232-20/+83
| | | | | | | | Update docstring and library reference section on 'sys' module. New API PyErr_Display, just for displaying errors, called by excepthook. Uncaught exceptions now call sys.excepthook; if that fails, we fall back to calling PyErr_Display directly. Also comes with sys.__excepthook__ and sys.__displayhook__.