summaryrefslogtreecommitdiff
path: root/Python
AgeCommit message (Collapse)AuthorLines
2002-06-17PyModule_AddObject(): Added missing exceptions.Fred Drake-7/+14
Closes SF bug #523473.
2002-06-01Fix SF #561858 Assertion with very long listsNeal Norwitz-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.
2002-04-30backport tim_one's patch:Anthony Baxter-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
2002-04-20Backport fixes for two nested scopes bugs.Jeremy Hylton-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__.
2002-03-28Backport for 2.1.3 (if we ever release it; we may have to becauseGuido van Rossum-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!
2002-01-15Backport revision 2.69.Guido van Rossum-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.
2002-01-10Attempted to update all the copyright notices (we're releasing this inTim Peters-1/+1
2002!). Does anyone know of a copyright blurb I missed?
2002-01-10cosmetic change to add a commit message for the last commit, accidentlyAnthony Baxter-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.
2002-01-10thread_pthread.hAnthony Baxter-1/+1
2001-12-23backport of solaris thread patch, adding PTHREAD_SCOPE_SYSTEM support:Anthony Baxter-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).
2001-12-21backport 2.35:Anthony Baxter-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.
2001-12-21backport 2.153:Anthony Baxter-0/+3
Missing DECREFs when exception is raised in sys.excepthook.
2001-12-21backport 2.9:Anthony Baxter-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.
2001-12-21backport 2.144:Anthony Baxter-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.
2001-12-20Backport rev 2.301 to the 2.1 maintenance branch.Jeremy Hylton-1/+5
Add checks for stack underflow and overflow.
2001-11-21backport of jeremy's 2.227:Anthony Baxter-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.
2001-11-21backport of tim's 2.66:Anthony Baxter-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().
2001-11-21backport of 2.8, after checking with MarkHAnthony Baxter-17/+14
. Always pass a full path name to LoadLibraryEx(). Fixes some Windows 9x problems. As discussed on python-dev
2001-11-21backport of patches 2.10, 2.11, 2.12, by MvL.Anthony Baxter-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.
2001-11-21backport of 2.8 by jack:Anthony Baxter-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).
2001-11-21backport of 2.242:Anthony Baxter-2/+3
improved error message-- names the type of the unexpected object
2001-11-21backport of 2.90:Anthony Baxter-0/+5
Patch number #422106 by Greg Ball, to fix segmentation fault in sys.displayhook.
2001-10-21Backport fix from 2.277 - incorrectly swapped arguments to PyFrame_BlockSetup.Anthony Baxter-2/+2
Fixes very obscure and nasty bug.
2001-07-11Backport of Tim's checkin 2.178:Thomas Wouters-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.
2001-06-27Backport Tim's checkin 2.247:Thomas Wouters-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.
2001-06-27Backport Tim's checkin 2.201:Thomas Wouters-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.
2001-06-27Backport Jeremy's checkin 2.57:Thomas Wouters-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().
2001-06-27Backport Jeremy's checkin 2.244:Thomas Wouters-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.
2001-05-23Backport of Tim's checkin 2.177:Thomas Wouters-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.
2001-05-23Backport Tim's checkin 2.199:Thomas Wouters-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).
2001-05-23Backport Jeremy's checkin 2.198:Thomas Wouters-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.
2001-04-17This commit was manufactured by cvs2svn to create branchcvs2svn-211/+0
'release21-maint'.
2001-04-14Make some private symbols static.Guido van Rossum-3/+4
2001-04-13split long lineJeremy Hylton-1/+2
2001-04-13Change error message raised when free variable is not yet bound. ItJeremy Hylton-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.
2001-04-13Patch by Ping (SF bug 415879, Exception.__init__() causes segfault):Guido van Rossum-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.
2001-04-12Because this code was derived from Python 1.6.1 (amongst others), theGuido van Rossum-1/+1
CNRI copyright should be updated to include 2001.
2001-04-12Update copyright to PSF.Guido van Rossum-1/+1
2001-04-11Fix exception handling for non-PyFunction objects, SF bug 414743.Jeremy Hylton-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.
2001-04-10Updated version of RISCOS support. SF patch 411213 by Dietmar SchwertbergerGuido van Rossum-0/+4
2001-04-10test_pickle works on sizeof(long)==8 boxes again.Tim Peters-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.
2001-04-09Warn when assigning to __debug__ instead of raising an error.Jeremy Hylton-7/+2
2001-04-07SF patch #413552 - Premature decref on objectTim Peters-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.
2001-03-26Bug fix: compile() called from a nested-scopes-enable Python was notJeremy Hylton-1/+1
using nested scopes to compile its argument. Pass compiler flags through to underlying compile call.
2001-03-23Finishing touch to Ping's changes. This is a patch that Ping sent meGuido van Rossum-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.
2001-03-23call_sys_exitfunc(): Remove unused variable f.Fred Drake-1/+1
2001-03-23Allow sys.excepthook and sys.exitfunc to quietly exit with a sys.exit().Ka-Ping Yee-32/+37
sys.exitfunc gets the last word on the exit status of the program.
2001-03-23Make it illegal to assign to __debug__ as per Guido's request.Jeremy Hylton-1/+12
2001-03-23Fix memory leak with SyntaxError. (The DECREF was originally hiddenGuido van Rossum-0/+1
inside a piece of code that was deemed reduntant; the DECREF was unfortunately *not* redundant!)
2001-03-23Add sys.excepthook.Ka-Ping Yee-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__.