]> granicus.if.org Git - python/log
python
24 years agoFixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake [Mon, 11 Jun 2001 15:21:48 +0000 (15:21 +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.

Based on a suggestion from comp.lang.python.

24 years agoFix recent changes so that this section will format again.
Fred Drake [Mon, 11 Jun 2001 14:55:01 +0000 (14:55 +0000)]
Fix recent changes so that this section will format again.

24 years agoRenamed some stuff to tell the truth about what it does.
Tim Peters [Sun, 10 Jun 2001 23:52:59 +0000 (23:52 +0000)]
Renamed some stuff to tell the truth about what it does.

24 years agoInitial support for 'q' and 'Q' struct format codes: for now, only in
Tim Peters [Sun, 10 Jun 2001 23:40:19 +0000 (23:40 +0000)]
Initial support for 'q' and 'Q' struct format codes:  for now, only in
native mode, and only when config #defines HAVE_LONG_LONG.  Standard mode
will eventually treat them as 8-byte ints across all platforms, but that
likely requires a new set of routines in longobject.c first (while
sizeof(long) >= 4 is guaranteed by C, there's nothing in C we can rely
on x-platform to hold 8 bytes of int, so we'll have to roll our own;
I'm thinking of a simple pair of conversion functions, Python long
to/from sized vector of unsigned bytes; that may be useful for GMP
conversions too; std q/Q would call them with size fixed at 8).

test_struct.py:  In addition to adding some native-mode 'q' and 'Q' tests,
got rid of unused code, and repaired a non-portable assumption about
native sizeof(short) (it isn't 2 on some Cray boxes).

libstruct.tex:  In addition to adding a bit of 'q'/'Q' docs (more needed
later), removed an erroneous footnote about 'I' behavior.

24 years agoAdded a missing cast to the hashfunc initializer.
Jack Jansen [Sun, 10 Jun 2001 21:43:28 +0000 (21:43 +0000)]
Added a missing cast to the hashfunc initializer.

24 years agoSF bug 431772: traceback.print_exc() causes traceback
Tim Peters [Sun, 10 Jun 2001 18:58:26 +0000 (18:58 +0000)]
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).
Bugfix candidate.

24 years agoannoying whitespace inconsistency
Peter Schneider-Kamp [Sun, 10 Jun 2001 16:45:08 +0000 (16:45 +0000)]
annoying whitespace inconsistency

24 years agoSF bug 430991: wrong co_lnotab
Tim Peters [Sat, 9 Jun 2001 09:26:21 +0000 (09:26 +0000)]
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.

Bugfix candidate (line numbers may be off in tracebacks under -O).

24 years agoCast the result of xxxPyCObject_Import to PycStringIO_CAPI*.
Martin v. Löwis [Sat, 9 Jun 2001 07:59:43 +0000 (07:59 +0000)]
Cast the result of xxxPyCObject_Import to PycStringIO_CAPI*.
This fixes bug #431557.

24 years agoPatch #424475: Speed-up tp_compare usage, by special-casing the common
Martin v. Löwis [Sat, 9 Jun 2001 07:34:05 +0000 (07:34 +0000)]
Patch #424475: Speed-up tp_compare usage, by special-casing the common
case of objects with equal types which support tp_compare. Give
type objects a tp_compare function.
Also add c<0 tests before a few PyErr_Occurred tests.

24 years agoFix the attributions for the new floating point text.
Fred Drake [Fri, 8 Jun 2001 17:09:01 +0000 (17:09 +0000)]
Fix the attributions for the new floating point text.

24 years agoAdded credits in the right places.
Fred Drake [Fri, 8 Jun 2001 16:28:53 +0000 (16:28 +0000)]
Added credits in the right places.

24 years agoText from Tim & Guido discussing floating point arithmetic and what users
Fred Drake [Fri, 8 Jun 2001 16:24:58 +0000 (16:24 +0000)]
Text from Tim & Guido discussing floating point arithmetic and what users
need to understand about the binary & decimal fp, so that representation
weirdness is documented somewhere.  This makes it easier to repond to "bug"
reports caused by user confusion & ignorance of the issues.

This closes SF patch #426208.

24 years agoadd warning about situation where code may be executed twice, once when
Skip Montanaro [Fri, 8 Jun 2001 14:40:28 +0000 (14:40 +0000)]
add warning about situation where code may be executed twice, once when
module is __main__ and once when module is imported.

24 years agoIn the section on extending the profiler, add some additional discussion
Fred Drake [Fri, 8 Jun 2001 05:04:19 +0000 (05:04 +0000)]
In the section on extending the profiler, add some additional discussion
about setting up the dispatch table, and update the OldProfile and
HotProfile classes to the current implementations, showing the adjusted
construction for the dispatch table.

24 years agocall_trace(): Add an additional parameter -- pointer to a PyObject*
Fred Drake [Fri, 8 Jun 2001 04:33:09 +0000 (04:33 +0000)]
call_trace():  Add an additional parameter -- pointer to a PyObject*
    that should be used to cache an interned version of the event
    string passed to the profile/trace function.  call_trace() will
    create interned strings and cache them in using the storage
    specified by this additional parameter, avoiding a lot of string
    object creation at runtime when using the profiling or tracing
    functions.

All call sites are modified to pass the additional parameter, and four
static PyObject* variables are allocated to cache the interned string
objects.

This closes SF patch #431257.

24 years agoPerformance improvements to the profiler:
Fred Drake [Fri, 8 Jun 2001 04:25:24 +0000 (04:25 +0000)]
Performance improvements to the profiler:

Ensure that all the default timers are called as functions, not an
expensive method wrapper around a variety of different functions.

Agressively avoid dictionary lookups.

Modify the dispatch scheme (Profile.trace_dispatch_*(), where * is not
'call', 'exception' or 'return') so that the callables dispatched to
are simple functions and not bound methods -- this reduces the number
of layers of Python call machinery that gets touched.

Remove a couple of duplicate imports from the "if __name__ == ..."
section.

This closes SF patch #430948.

24 years agoPatch #429957: Add support for cp1140, which is identical to cp037,
Martin v. Löwis [Thu, 7 Jun 2001 19:39:25 +0000 (19:39 +0000)]
Patch #429957: Add support for cp1140, which is identical to cp037,
with the addition of the euro character.
Also added a few EDBDIC aliases.

24 years agoDocument filter.
Martin v. Löwis [Thu, 7 Jun 2001 19:01:24 +0000 (19:01 +0000)]
Document filter.

24 years agocheck in for patch #430846
Peter Schneider-Kamp [Thu, 7 Jun 2001 18:56:13 +0000 (18:56 +0000)]
check in for patch #430846

use faster code for base64.encodestring (courtesy of Mr. Tim Peters)
and for base64.decodestring (courtesy of Anthony Baxter)

24 years agoPatch #430754: Makes ftpmirror.py .netrc aware
Martin v. Löwis [Thu, 7 Jun 2001 17:17:00 +0000 (17:17 +0000)]
Patch #430754: Makes ftpmirror.py .netrc aware

24 years agoFixes [ #430986 ] Buglet in PyUnicode_FromUnicode.
Marc-André Lemburg [Thu, 7 Jun 2001 12:26:56 +0000 (12:26 +0000)]
Fixes [ #430986 ] Buglet in PyUnicode_FromUnicode.

24 years agoPrevious check-in was by mistake, undo it.
Martin v. Löwis [Thu, 7 Jun 2001 05:52:17 +0000 (05:52 +0000)]
Previous check-in was by mistake, undo it.

24 years agoThis closes bug #430849 (internal error produced by binascii.a2b_base64)
Peter Schneider-Kamp [Thu, 7 Jun 2001 05:51:36 +0000 (05:51 +0000)]
This closes bug #430849 (internal error produced by binascii.a2b_base64)

24 years agoPatch #416220: Fix misplaced paren.
Martin v. Löwis [Thu, 7 Jun 2001 05:49:05 +0000 (05:49 +0000)]
Patch #416220: Fix misplaced paren.

24 years agoAcknowledge the existence of the 'platform' file, generated by the
Guido van Rossum [Wed, 6 Jun 2001 17:51:57 +0000 (17:51 +0000)]
Acknowledge the existence of the 'platform' file, generated by the
Makefile and used by the setup.py script.  Ignore it in .cvsignore;
remove it in "make clobber".

24 years agoTypo: "descrition" --> "description"
Fred Drake [Wed, 6 Jun 2001 16:02:47 +0000 (16:02 +0000)]
Typo:  "descrition" --> "description"

Add reference to the documentation for the Python documentation markup.

Fixed up a couple of descriptions.

This closes SF bug #430627.

24 years agoAdd references to the documentation for the Python documentation markup.
Fred Drake [Wed, 6 Jun 2001 15:59:04 +0000 (15:59 +0000)]
Add references to the documentation for the Python documentation markup.
Suggested by the comments in SF bug #430627.

24 years agoAdded quopri codec.
Guido van Rossum [Wed, 6 Jun 2001 13:30:54 +0000 (13:30 +0000)]
Added quopri codec.

24 years agoReport on fnmatch.filter.
Martin v. Löwis [Wed, 6 Jun 2001 06:25:40 +0000 (06:25 +0000)]
Report on fnmatch.filter.

24 years agoPatch #409973: Speedup glob.glob, add fnmatch.filter.
Martin v. Löwis [Wed, 6 Jun 2001 06:24:38 +0000 (06:24 +0000)]
Patch #409973: Speedup glob.glob, add fnmatch.filter.

24 years agoWrap with extern "C". Fixes bug #428419.
Martin v. Löwis [Tue, 5 Jun 2001 05:58:44 +0000 (05:58 +0000)]
Wrap with extern "C". Fixes bug #428419.
Also protect against multiple inclusion.

24 years agoFix bug #422702: Make flag argument to open optional, and document it that way.
Martin v. Löwis [Tue, 5 Jun 2001 05:33:19 +0000 (05:33 +0000)]
Fix bug #422702: Make flag argument to open optional, and document it that way.

24 years agoAdd .pyo as an extension, fixes bug #416462. Also restore alphabetic order.
Martin v. Löwis [Tue, 5 Jun 2001 05:17:00 +0000 (05:17 +0000)]
Add .pyo as an extension, fixes bug #416462. Also restore alphabetic order.

24 years agoMake it possible to find the use of tp_as_buffer here with a global search.
Tim Peters [Tue, 5 Jun 2001 04:43:26 +0000 (04:43 +0000)]
Make it possible to find the use of tp_as_buffer here with a global search.
(Just a change to a comment)

24 years agoUpdate a "Programmer's note" about lambda forms and scoping to reflect
Fred Drake [Tue, 5 Jun 2001 02:17:02 +0000 (02:17 +0000)]
Update a "Programmer's note" about lambda forms and scoping to reflect
the availability of nested scoping in Python 2.1 and 2.2.

24 years agoQuick update to the extension mechanism (extend.py is gone, long live
Guido van Rossum [Mon, 4 Jun 2001 21:21:11 +0000 (21:21 +0000)]
Quick update to the extension mechanism (extend.py is gone, long live
config.txt).

*** This is a bugfix-release candidate (for 2.1.1 and 2.0.1)! ***

24 years agoStore the mask instead of the size in dictobjects. The mask is more
Tim Peters [Mon, 4 Jun 2001 21:00:21 +0000 (21:00 +0000)]
Store the mask instead of the size in dictobjects.  The mask is more
frequently used, and in particular this allows to drop the last
remaining obvious time-waster in the crucial lookdict() and
lookdict_string() functions.  Other changes consist mostly of changing
"i < ma_size" to "i <= ma_mask" everywhere.

24 years agois -> if in rename description
Skip Montanaro [Mon, 4 Jun 2001 15:31:17 +0000 (15:31 +0000)]
is -> if in rename description

24 years agoConvert the parser module test to use PyUnit.
Fred Drake [Mon, 4 Jun 2001 03:56:24 +0000 (03:56 +0000)]
Convert the parser module test to use PyUnit.

24 years agoAdd some useful Windows encodings - patch #423221.
Mark Hammond [Mon, 4 Jun 2001 02:31:23 +0000 (02:31 +0000)]
Add some useful Windows encodings - patch #423221.

24 years agoImplement testGetElementsByTagNameNS.
Martin v. Löwis [Sun, 3 Jun 2001 14:27:02 +0000 (14:27 +0000)]
Implement testGetElementsByTagNameNS.

24 years agoFix getElementsByTagNameNS:
Martin v. Löwis [Sun, 3 Jun 2001 14:06:42 +0000 (14:06 +0000)]
Fix getElementsByTagNameNS:
  - actually return a result
  - Compare with tag.localName in getElementsByTagNameNSHelper

24 years agolookdict: stop more insane core-dump mutating comparison cases. Should
Tim Peters [Sun, 3 Jun 2001 04:54:32 +0000 (04:54 +0000)]
lookdict:  stop more insane core-dump mutating comparison cases.  Should
be possible to provoke unbounded recursion now, but leaving that to someone
else to provoke and repair.
Bugfix candidate -- although this is getting harder to backstitch, and the
cases it's protecting against are mondo contrived.

24 years agolookdict: Reduce obfuscating code duplication with a judicious goto.
Tim Peters [Sun, 3 Jun 2001 04:14:43 +0000 (04:14 +0000)]
lookdict:  Reduce obfuscating code duplication with a judicious goto.
This code is likely to get even hairier to squash core dumps due to
mutating comparisons, and it's hard enough to follow without that.

24 years agoExplained more differences between PyList_SetItem() and PyList_SET_ITEM().
Fred Drake [Sun, 3 Jun 2001 03:12:57 +0000 (03:12 +0000)]
Explained more differences between PyList_SetItem() and PyList_SET_ITEM().
In particular, the affect on existing list content was not sufficiently
explained.

This closes SF bug #429554.

24 years agoFinish the dict->string coredump fix. Need sleep.
Tim Peters [Sat, 2 Jun 2001 08:27:39 +0000 (08:27 +0000)]
Finish the dict->string coredump fix.  Need sleep.
Bugfix candidate.

24 years agoFix comment.
Tim Peters [Sat, 2 Jun 2001 08:18:58 +0000 (08:18 +0000)]
Fix comment.

24 years agoCoredumpers from Michael Hudson, mutating dicts while printing or
Tim Peters [Sat, 2 Jun 2001 08:02:56 +0000 (08:02 +0000)]
Coredumpers from Michael Hudson, mutating dicts while printing or
converting to string.
Critical bugfix candidate -- if you take this seriously <wink>.

24 years agoSeparate CFLAGS and CPPFLAGS. CFLAGS should not contain preprocessor
Neil Schemenauer [Sat, 2 Jun 2001 06:16:02 +0000 (06:16 +0000)]
Separate CFLAGS and CPPFLAGS.  CFLAGS should not contain preprocessor
directives, which is the role of CPPFLAGS.  Closes SF patch #414991.

24 years agodict_popitem(): Repaired last-second 2.1 comment, which misidentified the
Tim Peters [Sat, 2 Jun 2001 05:42:29 +0000 (05:42 +0000)]
dict_popitem():  Repaired last-second 2.1 comment, which misidentified the
true reason for allocating the tuple before checking the dict size.

24 years agoNew collision resolution scheme: no polynomials, simpler, faster, less
Tim Peters [Sat, 2 Jun 2001 05:27:19 +0000 (05:27 +0000)]
New collision resolution scheme:  no polynomials, simpler, faster, less
code, less memory.  Tests have uncovered no drawbacks.  Christian and
Vladimir are the other two people who have burned many brain cells on the
dict code in recent years, and they like the approach too, so I'm checking
it in without further ado.

24 years agomore public symbols for __all__
Skip Montanaro [Fri, 1 Jun 2001 16:25:38 +0000 (16:25 +0000)]
more public symbols for __all__

24 years agoDocument os.getenv().
Fred Drake [Thu, 31 May 2001 20:27:46 +0000 (20:27 +0000)]
Document os.getenv().
This closes SF bug #429059.

24 years agoSome general cleanup of the threading module documentation, including
Fred Drake [Thu, 31 May 2001 20:24:07 +0000 (20:24 +0000)]
Some general cleanup of the threading module documentation, including
fixing the reference to Thread.getDeamon() (should be isDaemon()).

This closes SF bug #429070.

24 years agoPyErr_Occurred(): Use PyThreadState_GET(), which saves a tiny function call
Tim Peters [Wed, 30 May 2001 06:09:50 +0000 (06:09 +0000)]
PyErr_Occurred():  Use PyThreadState_GET(), which saves a tiny function call
in release builds.  Suggested by Martin v. Loewis.

I'm half tempted to macroize PyErr_Occurred too, as the whole thing could
collapse to just
     _PyThreadState_Current->curexc_type

24 years agoAdded entry for HTMLParser documentation.
Fred Drake [Wed, 30 May 2001 04:59:50 +0000 (04:59 +0000)]
Added entry for HTMLParser documentation.

24 years agoMichel Pelletier <michel@digicool.com>:
Fred Drake [Wed, 30 May 2001 04:59:00 +0000 (04:59 +0000)]
Michel Pelletier <michel@digicool.com>:
Documentation for the HTMLParser module, with small changes by FLD.

24 years agoThis division test was too stringent in its accuracy expectations for
Tim Peters [Tue, 29 May 2001 22:18:09 +0000 (22:18 +0000)]
This division test was too stringent in its accuracy expectations for
random inputs:  if you ran the test 100 times, you could expect it to
report a bogus failure.  So loosened its expectations.
Also changed the way failing tests are printed, so that when run under
regrtest.py we get enough info to reproduce the failure.

24 years agoBadDictKey test: The output file expected "raising error" to be printed
Tim Peters [Tue, 29 May 2001 21:14:32 +0000 (21:14 +0000)]
BadDictKey test:  The output file expected "raising error" to be printed
exactly once.  But the test code can't know that, as the number of times
__cmp__ is called depends on internal details of the dict implementation.
This is especially nasty because the __hash__ method returns the address
of the class object, so the hash codes seen by the dict can vary across
runs, causing the dict to use a different probe order across runs.  I
just happened to see this test fail about 1 run in 7 today, but only
under a release build and when passing -O to Python.  So, changed the test
to be predictable across runs.

24 years agoNew solution to the "Someone stuck a colon in that filename!" problem:
Fred Drake [Tue, 29 May 2001 19:53:46 +0000 (19:53 +0000)]
New solution to the "Someone stuck a colon in that filename!" problem:
Allow colons in the labels used for internal references, but do not
expose them when generating filename.

24 years agoUsers of PySequence_GET_FAST() should get the length of the sequence using
Fred Drake [Tue, 29 May 2001 18:51:41 +0000 (18:51 +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.

24 years agoreadlink() description: Added note that the return value may be either
Fred Drake [Tue, 29 May 2001 18:13:06 +0000 (18:13 +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.

This closes SF patch #426598.

24 years agoChange cascaded if stmts to switch stmt in vgetargs1().
Jeremy Hylton [Tue, 29 May 2001 17:46:19 +0000 (17:46 +0000)]
Change cascaded if stmts to switch stmt in vgetargs1().

In the default branch, keep three ifs that are used if level == 0, the
most common case.  Note that first if here is a slight optimization
for the 'O' format.

Second part of SF patch 426072.

24 years agoInternal refactoring of convertsimple() and friends.
Jeremy Hylton [Tue, 29 May 2001 17:37:05 +0000 (17:37 +0000)]
Internal refactoring of convertsimple() and friends.

Note that lots of code was re-indented.

Replace two-step of convertsimple() and convertsimple1() with
convertsimple() and helper converterr(), which is called to format
error messages when convertsimple() fails.  The old code did all the
real work in convertsimple1(), but deferred error message formatting
to conversimple().  The result was paying the price of a second
function call on every call just to format error messages in the
failure cases.

Factor out of the buffer-handling code in convertsimple() and package
it as convertbuffer().

Add two macros to ease readability of Unicode coversions,
UNICODE_DEFAULT_ENCODING() and CONV_UNICODE, an error string.

The convertsimple() routine had awful indentation problems, primarily
because there were two tabs between the case line and the body of the
case statements.  This patch reformats the entire function to have a
single tab between case line and case body, which makes the code
easier to read (and consistent with ceval).  The introduction of
converterr() exacerbated the problem and prompted this fix.

Also, eliminate non-standard whitespace after opening paren and before
closing paren in a few if statements.

(This checkin is part of SF patch 426072.)

24 years agofix bogus indentation
Jeremy Hylton [Tue, 29 May 2001 17:13:15 +0000 (17:13 +0000)]
fix bogus indentation

24 years agoruntest(): When generating output, if the result is a single line with the
Fred Drake [Tue, 29 May 2001 17:10:51 +0000 (17:10 +0000)]
runtest():  When generating output, if the result is a single line with the
    name of the test, only write the output file if it already exists (and
    tell the user to consider removing it).  This avoids the generation of
    unnecessary turds.

24 years agoThe one-line output files are no longer needed, so do not keep them.
Fred Drake [Tue, 29 May 2001 16:54:22 +0000 (16:54 +0000)]
The one-line output files are no longer needed, so do not keep them.

24 years agoVariety of test cases for call to builtin functions
Jeremy Hylton [Tue, 29 May 2001 16:26:20 +0000 (16:26 +0000)]
Variety of test cases for call to builtin functions

24 years agoFix bug reported by Tim Peters on python-dev:
Jeremy Hylton [Tue, 29 May 2001 16:23:26 +0000 (16:23 +0000)]
Fix bug reported by Tim Peters on python-dev:

Keyword arguments passed to builtin functions that don't take them are
ignored.

>>> {}.clear(x=2)
>>>

instead of

>>> {}.clear(x=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: clear() takes no keyword arguments

24 years agoHack to make this play nicer with *old* versions of Python: os.path.abspath()
Fred Drake [Tue, 29 May 2001 16:10:07 +0000 (16:10 +0000)]
Hack to make this play nicer with *old* versions of Python: os.path.abspath()
was not available in Python 1.5.1.  (Yes, a user actually tried to use this
with that version of Python!)

24 years agoBring the notes on the relationship between __cmp__(), __eq__(), and
Fred Drake [Tue, 29 May 2001 16:02:35 +0000 (16:02 +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.

24 years agoFix typo reported in SF bug #427783.
Fred Drake [Tue, 29 May 2001 15:44:27 +0000 (15:44 +0000)]
Fix typo reported in SF bug #427783.

24 years agoThe parameter to the listen() method is not optional, but was marked as
Fred Drake [Tue, 29 May 2001 15:37:45 +0000 (15:37 +0000)]
The parameter to the listen() method is not optional, but was marked as
optional in the documentation.

This closes SF bug #427985.

24 years agoRemoved information on the old third parameter to _PyTuple_Resize().
Fred Drake [Tue, 29 May 2001 15:34:06 +0000 (15:34 +0000)]
Removed information on the old third parameter to _PyTuple_Resize().

Added information on PyIter_Check(), PyIter_Next(),
PyObject_Unicode(), PyString_AsDecodedObject(),
PyString_AsEncodedObject(), and PyThreadState_GetDict().

24 years agoIf the input line does not contain enough fields, raise a meaningful
Fred Drake [Tue, 29 May 2001 15:25:51 +0000 (15:25 +0000)]
If the input line does not contain enough fields, raise a meaningful
error.

24 years agoDo not start API descriptions with "Does the same, but ..." -- actually
Fred Drake [Tue, 29 May 2001 15:13:00 +0000 (15:13 +0000)]
Do not start API descriptions with "Does the same, but ..." -- actually
state *which* other function the current one is like, even if the
descriptions are adjacent.

Revise the _PyTuple_Resize() description to reflect the removal of the
third parameter.

24 years ago_PyTuple_Resize: guard against PyTuple_New() returning NULL, using Tim's
Thomas Wouters [Tue, 29 May 2001 07:58:45 +0000 (07:58 +0000)]
_PyTuple_Resize: guard against PyTuple_New() returning NULL, using Tim's
suggestion (modulo style).

24 years agoWhitespace normalization.
Tim Peters [Tue, 29 May 2001 06:06:54 +0000 (06:06 +0000)]
Whitespace normalization.

24 years agoPatch from Gordon McMillan.
Tim Peters [Tue, 29 May 2001 04:27:01 +0000 (04:27 +0000)]
Patch from Gordon McMillan.
updatecache():  When using imputil, sys.path may contain things other than
strings.  Ignore such things instead of blowing up.
Hard to say whether this is a bugfix or a feature ...

24 years agoCruft cleanup: Removed the unused last_is_sticky argument from the internal
Tim Peters [Mon, 28 May 2001 22:30:08 +0000 (22:30 +0000)]
Cruft cleanup:  Removed the unused last_is_sticky argument from the internal
_PyTuple_Resize().

24 years ago_PyTuple_Resize: take into account the empty tuple. There can be only one.
Thomas Wouters [Mon, 28 May 2001 13:11:02 +0000 (13:11 +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.

This fixes (at least) SF bug #420343.

24 years agoImplement an old idea of Christian Tismer's: use polynomial division
Tim Peters [Sun, 27 May 2001 07:39:22 +0000 (07:39 +0000)]
Implement an old idea of Christian Tismer's:  use polynomial division
instead of multiplication to generate the probe sequence.  The idea is
recorded in Python-Dev for Dec 2000, but that version is prone to rare
infinite loops.

The value is in getting *all* the bits of the hash code to participate;
and, e.g., this speeds up querying every key in a dict with keys
 [i << 16 for i in range(20000)] by a factor of 500.  Should be equally
valuable in any bad case where the high-order hash bits were getting
ignored.

Also wrote up some of the motivations behind Python's ever-more-subtle
hash table strategy.

24 years agoWhen reading from stdin (with the dialog box) use any partial line on
Jack Jansen [Sat, 26 May 2001 20:01:41 +0000 (20:01 +0000)]
When reading from stdin (with the dialog box) use any partial line on
stdout as the prompt. This makes raw_input() and print "xxx", ; sys.stdin.readline() work a bit more palatable.

24 years agoChange list.extend() error msgs and NEWS to reflect that list.extend()
Tim Peters [Sat, 26 May 2001 19:37:54 +0000 (19:37 +0000)]
Change list.extend() error msgs and NEWS to reflect that list.extend()
now takes any iterable argument, not only sequences.

NEEDS DOC CHANGES -- but I don't think we settled on a concise way to
say this stuff.

24 years agoCruft cleanup: removed the #ifdef'ery in support of compiling to allow
Tim Peters [Sat, 26 May 2001 05:50:03 +0000 (05:50 +0000)]
Cruft cleanup:  removed the #ifdef'ery in support of compiling to allow
multi-argument list.append(1, 2, 3) (as opposed to .append((1,2,3))).

24 years agoroundupsize() and friends: fiddle over-allocation strategy for list
Tim Peters [Sat, 26 May 2001 05:28:40 +0000 (05:28 +0000)]
roundupsize() and friends:  fiddle over-allocation strategy for list
resizing.

Accurate timings are impossible on my Win98SE box, but this is obviously
faster even on this box for reasonable list.append() cases.  I give
credit for this not to the resizing strategy but to getting rid of integer
multiplication and divsion (in favor of shifting) when computing the
rounded-up size.

For unreasonable list.append() cases, Win98SE now displays linear behavior
for one-at-time appends up to a list with about 35 million elements.  Then
it dies with a MemoryError, due to fatally fragmented *address space*
(there's plenty of VM available, but by this point Win9X has broken user
space into many distinct heaps none of which has enough contiguous space
left to resize the list, and for whatever reason Win9x isn't coalescing
the dead heaps).  Before the patch it got a MemoryError for the same
reason, but once the list reached about 2 million elements.

Haven't yet tried on Win2K but have high hopes extreme list.append()
will be much better behaved now (NT & Win2K didn't fragment address space,
but suffered obvious quadratic-time behavior before as lists got large).

For other systems I'm relying on common sense:  replacing integer * and /
by << and >> can't plausibly hurt, the number of function calls hasn't
changed, and the total operation count for reasonably small lists is about
the same (while the operations are cheaper now).

24 years agoAdd a version annotation for splitdrive(); old, but as long as I managed
Fred Drake [Fri, 25 May 2001 16:21:00 +0000 (16:21 +0000)]
Add a version annotation for splitdrive(); old, but as long as I managed
to end up with the information, it is better recorded than lost.

24 years agoAdd descriptions of {}.iteritems(), {}.iterkeys(), and {}.itervalues()
Fred Drake [Fri, 25 May 2001 04:24:37 +0000 (04:24 +0000)]
Add descriptions of {}.iteritems(), {}.iterkeys(), and {}.itervalues()
in the table of mapping object operations.  Re-numbered the list of
notes to reflect the move of the "Added in version 2.2." note to the list
of notes instead of being inserted into the last column of the table.

24 years agowrite(): Aggressively sort all catalog entries, and fix the bug where
Barry Warsaw [Thu, 24 May 2001 23:06:13 +0000 (23:06 +0000)]
write(): Aggressively sort all catalog entries, and fix the bug where
there were multiple translatable strings on a single line of source
code.

24 years agoPatch #424335: Implement string_richcompare, remove string_compare.
Martin v. Löwis [Thu, 24 May 2001 16:56:35 +0000 (16:56 +0000)]
Patch #424335: Implement string_richcompare, remove string_compare.
               Use new _PyString_Eq in lookdict_string.

24 years agodictresize(): Rebuild small tables if there are any dummies, not just if
Tim Peters [Thu, 24 May 2001 16:26:40 +0000 (16:26 +0000)]
dictresize():  Rebuild small tables if there are any dummies, not just if
they're entirely full.  Not a question of correctness, but of temporarily
misplaced common sense.

24 years agoJack Jansen hit a bug in the new dict code, reported on python-dev.
Tim Peters [Wed, 23 May 2001 23:33:57 +0000 (23:33 +0000)]
Jack Jansen hit a bug in the new dict code, reported on python-dev.

dictresize() was too aggressive about never ever resizing small dicts.
If a small dict is entirely full, it needs to rebuild it despite that
it won't actually resize it, in order to purge old dummy entries thus
creating at least one virgin slot (lookdict assumes at least one such
exists).

Also took the opportunity to add some high-level comments to dictresize.

24 years agoOne more macroman<->latin1 conversion victim.
Jack Jansen [Wed, 23 May 2001 20:03:06 +0000 (20:03 +0000)]
One more macroman<->latin1 conversion victim.

24 years agowrite(): Do two levels of sorting: first sort the individual location
Barry Warsaw [Wed, 23 May 2001 16:59:45 +0000 (16:59 +0000)]
write(): Do two levels of sorting: first sort the individual location
tuples by filename/lineno, then sort the catalog entries by their
location tuples.

24 years agoWhen Tim untabified this file, his editor accidentally assumed 4-space
Guido van Rossum [Wed, 23 May 2001 13:24:30 +0000 (13:24 +0000)]
When Tim untabified this file, his editor accidentally assumed 4-space
tabs.  The title was centered using 8-byte tabs, however, and the
result looked strange.  Fixed this.

24 years agoUpdated to reflect the current state of config.h.in.
Jack Jansen [Wed, 23 May 2001 08:55:50 +0000 (08:55 +0000)]
Updated to reflect the current state of config.h.in.

24 years agoRemove test_doctest's expected-output file.
Tim Peters [Wed, 23 May 2001 07:46:36 +0000 (07:46 +0000)]
Remove test_doctest's expected-output file.
Change test_doctest and test_difflib to pass regrtest's notion of
verbosity on to doctest.
Add explanation for a dozen "new" things to test/README.

24 years agoUpdate to reflect recent changes to regrtest and the new approaches to
Fred Drake [Wed, 23 May 2001 04:57:49 +0000 (04:57 +0000)]
Update to reflect recent changes to regrtest and the new approaches to
testing using doctest and PyUnit.

24 years agoMerge my changes to the offending comment with Guido's changes.
Fred Drake [Wed, 23 May 2001 04:53:44 +0000 (04:53 +0000)]
Merge my changes to the offending comment with Guido's changes.