Thomas Wouters [Mon, 9 Jul 2001 14:34:16 +0000 (14:34 +0000)]
Fix for SF bug #436525, reported by Greg Kochanski:
The block/unblock thread macros are called 'Py_BLOCK_THREADS' and
'Py_UNBLOCK_THREADS', not 'Py_BEGIN_BLOCK_THREADS' and
'Py_BEGIN_UNBLOCK_THREADS'.
Fred Drake [Fri, 6 Jul 2001 17:23:22 +0000 (17:23 +0000)]
When reading a continuation line, make sure we still use the transformed
name when filling in the internal data structures, otherwise we incorrectly
raise a KeyError.
Fred Drake [Thu, 5 Jul 2001 18:22:48 +0000 (18:22 +0000)]
Allow underscores in tag names and quote characters in unquoted attribute
values. The change for attribute values matches the way Mozilla and
Navigator view the world, at least.
Fred Drake [Fri, 29 Jun 2001 15:41:19 +0000 (15:41 +0000)]
SourceForge bug #437041:
Use a portable format in the example that creates a timestamp suitable for
use in email, also updating it and the footnote from RFC 822 to RFC 2822.
Fred Drake [Fri, 29 Jun 2001 15:00:34 +0000 (15:00 +0000)]
Simplify an example based on comment from Thomas Holenstein <thomas@hex.ch>:
Do not use an extra flag variable to test only once in one subsequent if
statement.
Thomas Wouters [Wed, 27 Jun 2001 14:26:58 +0000 (14:26 +0000)]
Backport of Tim's checkin 1.35:
SF bug 434186: 0x80000000/2 != 0x80000000>>1
i_divmod: New and simpler algorithm. Old one returned gibberish on most
boxes when the numerator was -sys.maxint-1. Oddly enough, it worked in the
release (not debug) build on Windows, because the compiler optimized away
some tricky sign manipulations that were incorrect in this case.
Makes you wonder <wink> ...
Thomas Wouters [Wed, 27 Jun 2001 14:24:12 +0000 (14:24 +0000)]
Backport of Tim's checkin 2.57:
SF bug 434186: 0x80000000/2 != 0x80000000>>1
i_divmod: New and simpler algorithm. Old one returned gibberish on most
boxes when the numerator was -sys.maxint-1. Oddly enough, it worked in the
release (not debug) build on Windows, because the compiler optimized away
some tricky sign manipulations that were incorrect in this case.
Makes you wonder <wink> ...
Thomas Wouters [Wed, 27 Jun 2001 14:07:50 +0000 (14:07 +0000)]
Backport Tim's checkin 1.26 (patch probably by Michael Hudson, not Hundson):
SF bug 431772: traceback.print_exc() causes traceback
Patch from Michael Hundson.
format_exception_only() blew up when trying to report a SyntaxError
from a string input (line is None in this case, but it assumed a string).
Thomas Wouters [Wed, 27 Jun 2001 14:04:03 +0000 (14:04 +0000)]
Backport Tim's checkin 2.201:
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.
Thomas Wouters [Wed, 27 Jun 2001 14:03:30 +0000 (14:03 +0000)]
Backport Tim's checkin 1.20:
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.
Thomas Wouters [Wed, 27 Jun 2001 14:02:14 +0000 (14:02 +0000)]
Backport Tim's checkin 1.97:
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.
Thomas Wouters [Wed, 27 Jun 2001 13:11:09 +0000 (13:11 +0000)]
Backport Jeremy's checkin 2.57:
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().
Thomas Wouters [Wed, 27 Jun 2001 13:09:44 +0000 (13:09 +0000)]
Backport Jeremy's checkin 2.244:
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.
Fred Drake [Fri, 22 Jun 2001 17:17:02 +0000 (17:17 +0000)]
Adjust to understand use of either single- or double-quotes to quote
attribute values, and make the logic surrounding the platform
annotations just a little easier to read. Also make the platform
notes appear in the generated page; they were supposed to, but did not.
Fred Drake [Thu, 21 Jun 2001 18:52:50 +0000 (18:52 +0000)]
Adjust the documents so that the copyright is at the front of the documents
and the license statements are at the end. This is less annoying to readers.
Thomas Wouters [Fri, 15 Jun 2001 11:58:49 +0000 (11:58 +0000)]
Protect several more uses of constants with #ifdefs; these are necessary on
(at least) SCO OpenServer 5. Fixes a non-SF-submitted bugreport by Michael
Kent.
Guido van Rossum [Tue, 12 Jun 2001 16:29:12 +0000 (16:29 +0000)]
Incorporating MAL's bugfix into the 2.1.1 branch:
revision 1.53
date: 2001/06/12 16:13:51; author: lemburg; state: Exp; lines: +1 -1
Removed the Python version from the PYTHONHOMEHELP string. It was
still set to python2.0 ...
Fred Drake [Mon, 11 Jun 2001 15:22:23 +0000 (15:22 +0000)]
Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
a reference to these functions and popen() from the "Process Management"
section.
Fred Drake [Mon, 11 Jun 2001 14:57:07 +0000 (14:57 +0000)]
Merge in recent changes from development branch: add warning about being
sure that code only runs once when using the module as both a module and a
script.
Fred Drake [Sun, 3 Jun 2001 03:16:04 +0000 (03:16 +0000)]
Explained more differences between PyList_SetItem() and PyList_SET_ITEM().
In particular, the affect on existing list content was not sufficiently
explained.
Fred Drake [Tue, 29 May 2001 18:53:11 +0000 (18:53 +0000)]
Users of PySequence_GET_FAST() should get the length of the sequence using
PySequence_Size(), not PyObject_Size(): the later considers the mapping
methods as well as the sequence methods, which is not needed here. Either
should be equally fast in this case, but PySequence_Size() offers a better
conceptual match.
Fred Drake [Tue, 29 May 2001 18:14:26 +0000 (18:14 +0000)]
readlink() description: Added note that the return value may be either
absolute or relative.
remove(), rename() descriptions: Give more information about the cross-
platform behavior of these functions, so single-platform developers
can be aware of the potential issues when writing portable code.
Fred Drake [Tue, 29 May 2001 16:06:21 +0000 (16:06 +0000)]
Bring the notes on the relationship between __cmp__(), __eq__(), and
__hash__() up to date (re: use of objects which define these methods
as dictionary keys).
This closes SF bug #427698.
Migrated comments about supporting __contains__() and the use of the "in"
operator from the development branch.
Thomas Wouters [Mon, 28 May 2001 13:04:33 +0000 (13:04 +0000)]
_PyTuple_Resize: take into account the empty tuple. There can be only one.
Instead of raising a SystemError, just create a new tuple of the desired
size.
Thomas Wouters [Wed, 23 May 2001 15:07:55 +0000 (15:07 +0000)]
Backport Tim's checkin 2.84:
SF bug #422121 Insecurities in dict comparison.
Fixed a half dozen ways in which general dict comparison could crash
Python (even cause Win98SE to reboot) in the presence of kay and/or
value comparison routines that mutate the dict during dict comparison.
Thomas Wouters [Wed, 23 May 2001 14:38:53 +0000 (14:38 +0000)]
Net result of Tim's checkins to stropmodule.c (2.78, 2.79, 2.80, 2.81),
stringobject.c (2.114, 2.115) and test_strop.py (1.11, 1.12). Fixes
'replace' behaviour on systems on which 'malloc(0)' returns NULL (together
with previous checkins) and re-synchs the string-operation code in
stringobject.c and stropmodule.c, with the exception of 'replace', which has
the old semantics in stropmodule but the new semantics in stringobjects.
Thomas Wouters [Wed, 23 May 2001 13:18:30 +0000 (13:18 +0000)]
Backport Tim's checkin 2.130:
SF bug #422108 - Error in rich comparisons.
Fix a bad (albeit unlikely) return value in try_rich_to_3way_compare().
Also document do_cmp()'s return values.
Thomas Wouters [Wed, 23 May 2001 13:03:13 +0000 (13:03 +0000)]
Net result of Guido's checkins of object.c (2.125 and 2.126), classobject.c
(2.128) and stringobject.c (2.105), which reworks PyObject_Str() and
PyObject_Repr() so strings and instances aren't special-cased, and
print >> file, instance
works like expected in all cases.
Thomas Wouters [Wed, 23 May 2001 12:51:22 +0000 (12:51 +0000)]
Backport of Tim's checkin 2.177:
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.
Thomas Wouters [Wed, 23 May 2001 12:46:45 +0000 (12:46 +0000)]
Backport Tim's checkin 2.199:
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).
Thomas Wouters [Wed, 23 May 2001 12:31:25 +0000 (12:31 +0000)]
Backport of Tim's checkin 2.88:
A different approach to the problem reported in
Patch #419651: Metrowerks on Mac adds 0x itself
C std says %#x and %#X conversion of 0 do not add the 0x/0X base marker.
Metrowerks apparently does. Mark Favas reported the same bug under a
Compaq compiler on Tru64 Unix, but no other libc broken in this respect
is known (known to be OK under MSVC and gcc).
So just try the damn thing at runtime and see what the platform does.
Note that we've always had bugs here, but never knew it before because
a relevant test case didn't exist before 2.1.
Thomas Wouters [Wed, 23 May 2001 12:30:59 +0000 (12:30 +0000)]
Backport Tim's checkin 2.104:
A different approach to the problem reported in
Patch #419651: Metrowerks on Mac adds 0x itself
C std says %#x and %#X conversion of 0 do not add the 0x/0X base marker.
Metrowerks apparently does. Mark Favas reported the same bug under a
Compaq compiler on Tru64 Unix, but no other libc broken in this respect
is known (known to be OK under MSVC and gcc).
So just try the damn thing at runtime and see what the platform does.
Note that we've always had bugs here, but never knew it before because
a relevant test case didn't exist before 2.1.
Thomas Wouters [Wed, 23 May 2001 12:15:57 +0000 (12:15 +0000)]
Backport Jeremy's checkin 1.7:
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.
Thomas Wouters [Wed, 23 May 2001 12:15:17 +0000 (12:15 +0000)]
Backport Jeremy's checkin 1.15:
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.
Thomas Wouters [Wed, 23 May 2001 12:11:35 +0000 (12:11 +0000)]
Backport Jeremy's checkin 2.198:
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.