Fred Drake [Tue, 11 Jun 2002 02:58:26 +0000 (02:58 +0000)]
Completely revise markup for the list of list methods; the new markup matches
the semantics and presentation used in the library reference.
Added an explanation of the use of [...] to denote optional arguments, since
this is the only use of this in a signature line.
Closes SF bug #567127.
Neal Norwitz [Sat, 1 Jun 2002 18:27:34 +0000 (18:27 +0000)]
Fix SF #561858 Assertion with very long lists
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.
Guido van Rossum [Fri, 31 May 2002 21:19:53 +0000 (21:19 +0000)]
Backport to 2.1.x:
SF bug 533625 (Armin Rigo). rexec: potential security hole
If a rexec instance allows writing in the current directory (a common
thing to do), there's a way to execute bogus bytecode. Fix this by
not allowing imports from .pyc files (in a way that allows a site to
configure things so that .pyc files *are* allowed, if writing is not
allowed).
Neal Norwitz [Wed, 29 May 2002 01:29:38 +0000 (01:29 +0000)]
Backport fix by tismer for #210682
fixed an old buglet that caused bdb to be unable to
continue in the botframe, after a breakpoint was set.
the key idea is not to set botframe to the bottom level frame,
but its f_back, which actually might be None.
Additional changes: migrated old exception trick to use
sys._getframe(), which exists both in 2.1 and 2.2 .
Note: I believe Mark Hammond needs to look over his code now.
F5 correctly starts up in the debugger, but later on doesn't stop at a given
breakpoint any longer.
Fred Drake [Thu, 2 May 2002 05:59:15 +0000 (05:59 +0000)]
Add information on support for repietition & concatenation for buffer
and xrange objects, and generally present these in the same way that more
recent documentation releases present them (for ease of maintenance).
This closes SF bug #550555.
Anthony Baxter [Tue, 30 Apr 2002 04:01:21 +0000 (04:01 +0000)]
backport tim_one's patch:
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
Anthony Baxter [Tue, 30 Apr 2002 03:58:47 +0000 (03:58 +0000)]
backport tim_one's patch:
[Re-did unicodeobject.c - it's changed a lot since 2.1 :) Pretty confident
that it's correct]
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/Objects/fileobject.c:2.161
python/dist/src/Objects/stringobject.c:2.161
python/dist/src/Objects/unicodeobject.c:2.147
Jeremy Hylton [Sat, 20 Apr 2002 18:21:29 +0000 (18:21 +0000)]
Backport fixes for two nested scopes bugs.
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__.
Anthony Baxter [Thu, 18 Apr 2002 05:09:06 +0000 (05:09 +0000)]
backport gvanrossum's patch:
Provisional fix for writefile() [SF bug # 541730].
The problem was that an exception can occur in the text.get() call or
in the write() call, when the text buffer contains non-ASCII
characters. This causes the previous contents of the file to be lost.
The provisional fix is to call str(self.text.get(...)) *before*
opening the file, so that if the exception occurs, we never open the
file.
Two orthogonal better solutions have to wait for policy decisions:
1. We could try to encode the data as Latin-1 or as UTF-8; but that
would require IDLE to grow a notion of file encoding which requires
more thought.
2. We could make backups before overwriting a file. This requires
more thought because it needs to be fast and cross-platform and
configurable.
Original patches were:
python/dist/src/Tools/idle/IOBinding.py:1.6
Tim Peters [Wed, 17 Apr 2002 04:36:16 +0000 (04:36 +0000)]
Windows installer: disabled Wise's "delete in-use files" uninstall
option. It was the cause of at least one way UNWISE.EXE could vanish
(install a python; uninstall it; install it again; reboot the machine;
abracadabra the uinstaller is gone).
Fred Drake [Wed, 17 Apr 2002 01:44:07 +0000 (01:44 +0000)]
Changed last two remaining uses of "./" to "index.html" when referring to the
index file for the top-level directory. This makes it easier to use an
unpacked version of the documentation via file: URLs.
This closes SF bug #541257.
Fred Drake [Thu, 4 Apr 2002 17:59:25 +0000 (17:59 +0000)]
Avoid creating circular references between the ExpatParser and the
ContentHandler. While GC will eventually clean up, it can take longer than
normal for applications that create a lot of strings (or other immutables)
rather without creating many containers.
This closes SF bug #535474.
Guido van Rossum [Thu, 28 Mar 2002 20:41:02 +0000 (20:41 +0000)]
Sort-of backport to 2.1.3 (if we ever release it) of the following.
(The fix looks different, but does the same thing to the 2.1 GC code
that Neil's patch does to the 2.2 GC code.)
This is Neil's fix for SF bug 535905 (Evil Trashcan and GC interaction).
The fix makes it possible to call PyObject_GC_UnTrack() more than once
on the same object, and then move the PyObject_GC_UnTrack() call to
*before* the trashcan code is invoked.
Guido van Rossum [Thu, 28 Mar 2002 20:21:21 +0000 (20:21 +0000)]
Backport for 2.1.3 (if we ever release it; we may have to because
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.
Fred Drake [Sat, 16 Mar 2002 06:26:20 +0000 (06:26 +0000)]
Clarify the descriptions of the positive and negative lookbehind assertions.
Added examples of positive lookbehind assertions.
This closes SF bug #529708.
Fred Drake [Wed, 13 Mar 2002 05:49:06 +0000 (05:49 +0000)]
Add a test that was added in Python 2.2: test Weak*Dictionary.setdefault().
The purpose is to avoid regression on SF bug #529273.
This test is stronger than the one submitted with the bug report.
Fred Drake [Wed, 13 Mar 2002 05:47:26 +0000 (05:47 +0000)]
Fix SF bug #529273: WeakValueDictionary.setdefault() raised UnboundLocalError
since it used the name of a global function as the name of a local. The
patch is almost identical to that submitted with the bug report.
Fred Drake [Wed, 13 Mar 2002 02:46:17 +0000 (02:46 +0000)]
Change the way \textasciitilde is implemented so it works more consistently
(dropping tildes into data that still goes through LaTeX-like processing is
a bad idea).