Thomas Wouters [Wed, 11 Jul 2001 12:15:15 +0000 (12:15 +0000)]
Backport of the socketserver test, including output file (which is still
necessary in the 2.1 branch.) Guido's original checkin message:
A test suite for SocketServer.py that exposes the various bugs just
fixed. Regrettably, this must be run manually -- somehow the I/O
redirection of the regression test breaks the test. When run under
the regression test, this raises ImportError with a warning to that
effect.
Thomas Wouters [Wed, 11 Jul 2001 12:05:49 +0000 (12:05 +0000)]
Backport of Guido's checkin 1.25:
Fix various serious problems:
- The ThreadingTCPServer class and its derived classes were completely
broken because the main thread would close the request before the
handler thread had time to look at it. This was introduced by
Ping's close_request() patch. The fix moves the close_request()
calls to after the handler has run to completion in the BaseServer
class and the ForkingMixIn class; when using the ThreadingMixIn,
closing the request is the handler's responsibility.
- The ForkingUDPServer class has always been been broken because the
socket was closed in the child before calling the handler. I fixed
this by simply not calling server_close() in the child at all.
- I cannot get the UnixDatagramServer class to work at all. The
recvfrom() call doesn't return a meaningful client address. I added
a comment to this effect. Maybe it works on other Unix versions.
- The __all__ variable was missing ThreadingMixIn and ForkingMixIn.
- Bumped __version__ to "0.4".
- Added a note about the test suite (to be checked in shortly).
Thomas Wouters [Wed, 11 Jul 2001 12:03:44 +0000 (12:03 +0000)]
Backport of Tim's checkin 2.178:
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.
Thomas Wouters [Wed, 11 Jul 2001 11:38:20 +0000 (11:38 +0000)]
Backport Tim's checkin 1.17:
SF patch #440144: Tests and minor bugfix for uu module
decode(): While writing tests for uu.py, Nick Mathewson discovered
that the 'Truncated input file' exception could never get raised,
because its "if not str:" test was actually testing the builtin
function "str", not the local string vrbl "s" as intended.
Fred Drake [Tue, 10 Jul 2001 16:11:09 +0000 (16:11 +0000)]
Document PyObject_New(), PyObject_NewVar(), PyObject_Init(),
PyObject_InitVar(), PyObject_Del(), PyObject_NEW(),
PyObject_NEW_VAR(), and PyObject_DEL().
Add notes to PyMem_Malloc() and PyMem_New() about the memory buffers
not being initialized.
This fixes SF bug #439012.
Added explicit return value information for PyList_SetItem(),
PyDict_SetItem(), and PyDict_SetItemString(). Corrected return type
for PyList_SET_ITEM().
Fixed index entries in the descriptions of PyLong_AsLong() and
PyLong_AsUnignedLong().
This fixes the API manual portion of SF bug #440037.
Note that the headers properly declare everything as 'extern "C"' for
C++ users.
Document _Py_NoneStruct.
Added links to the Extending & Embedding manual for PyArg_ParseTuple()
and PyArg_ParseTupleAndKeywords().
Added note that PyArg_Parse() should not be used in new code.
Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
translation more difficult, as well as reading the English more
difficult for non-native speakers.
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.