]> granicus.if.org Git - python/log
python
24 years agoMove the sha tests to PyUnit.
Fred Drake [Tue, 22 May 2001 21:43:17 +0000 (21:43 +0000)]
Move the sha tests to PyUnit.

24 years agoConvert binhex regression test to PyUnit. We could use a better test
Fred Drake [Tue, 22 May 2001 21:01:14 +0000 (21:01 +0000)]
Convert binhex regression test to PyUnit.  We could use a better test
for this.

24 years agoSF patch #425242: Patch which "inlines" small dictionaries.
Tim Peters [Tue, 22 May 2001 20:40:22 +0000 (20:40 +0000)]
SF patch #425242:  Patch which "inlines" small dictionaries.
The idea is Marc-Andre Lemburg's, the implementation is Tim's.
Add a new ma_smalltable member to dictobjects, an embedded vector of
MINSIZE (8) dictentry structs.  Short course is that this lets us avoid
additional malloc(s) for dicts with no more than 5 entries.

The changes are widespread but mostly small.

Long course:  WRT speed, all scalar operations (getitem, setitem, delitem)
on non-empty dicts benefit from no longer needing NULL-pointer checks
(ma_table is never NULL anymore).  Bulk operations (copy, update, resize,
clearing slots during dealloc) benefit in some cases from now looping
on the ma_fill count rather than on ma_size, but that was an unexpected
benefit:  the original reason to loop on ma_fill was to let bulk
operations on empty dicts end quickly (since the NULL-pointer checks
went away, empty dicts aren't special-cased any more).

Special considerations:

For dicts that remain empty, this change is a lose on two counts:
the dict object contains 8 new dictentry slots now that weren't
needed before, and dict object creation also spends time memset'ing
these doomed-to-be-unsused slots to NULLs.

For dicts with one or two entries that never get larger than 2, it's
a mix:  a malloc()/free() pair is no longer needed, and the 2-entry case
gets to use 8 slots (instead of 4) thus decreasing the chance of
collision.  Against that, dict object creation spends time memset'ing
4 slots that aren't strictly needed in this case.

For dicts with 3 through 5 entries that never get larger than 5, it's a
pure win:  the dict is created with all the space they need, and they
never need to resize.  Before they suffered two malloc()/free() calls,
plus 1 dict resize, to get enough space.  In addition, the 8-slot
table they ended with consumed more memory overall, because of the
hidden overhead due to the additional malloc.

For dicts with 6 or more entries, the ma_smalltable member is wasted
space, but then these are large(r) dicts so 8 slots more or less doesn't
make much difference.  They still benefit all the time from removing
ubiquitous dynamic null-pointer checks, and get a small benefit (but
relatively smaller the larger the dict) from not having to do two
mallocs, two frees, and a resize on the way *to* getting their sixth
entry.

All in all it appears a small but definite general win, with larger
benefits in specific cases.  It's especially nice that it allowed to
get rid of several branches, gotos and labels, and overall made the
code smaller.

24 years agoConvert copy_reg test to PyUnit.
Fred Drake [Tue, 22 May 2001 20:38:44 +0000 (20:38 +0000)]
Convert copy_reg test to PyUnit.

24 years agoRemove unused import.
Fred Drake [Tue, 22 May 2001 20:25:05 +0000 (20:25 +0000)]
Remove unused import.

24 years agoSimple conversion to PyUnit -- this test really needs more work!
Fred Drake [Tue, 22 May 2001 20:22:06 +0000 (20:22 +0000)]
Simple conversion to PyUnit -- this test really needs more work!

24 years agoConvert dospath test suite to PyUnit, adding a couple more cases for
Fred Drake [Tue, 22 May 2001 20:20:49 +0000 (20:20 +0000)]
Convert dospath test suite to PyUnit, adding a couple more cases for
isabs() (no false results were checked) and splitdrive().

24 years agoRe-write the rfc822 tests to use PyUnit.
Fred Drake [Tue, 22 May 2001 19:38:31 +0000 (19:38 +0000)]
Re-write the rfc822 tests to use PyUnit.
Update to reflect using "" as the default value for the second parameter
to the get() method.

24 years agoPer discussion with Barry, make the default value for both get() and
Fred Drake [Tue, 22 May 2001 19:36:50 +0000 (19:36 +0000)]
Per discussion with Barry, make the default value for both get() and
setdefault() the empty string.  In setdefault(), use + to join the value
to create the entry for the headers attribute so that TypeError is raised
if the value is of the wrong type.

24 years agoImplementing an idea from Guido on the checkins list:
Tim Peters [Tue, 22 May 2001 18:28:25 +0000 (18:28 +0000)]
Implementing an idea from Guido on the checkins list:
When regrtest.py finds an attribute "test_main" in a test it imports,
regrtest runs the test's test_main after the import.  test_threaded_import
needs this else the cross-thread import lock prevents it from making
progress.  Other tests can use this hack too, but I doubt it will ever be
popular.

24 years agoConvert time module tests to PyUnit.
Fred Drake [Tue, 22 May 2001 17:02:02 +0000 (17:02 +0000)]
Convert time module tests to PyUnit.

24 years agofile_getiter(): make iter(file) be equivalent to file.xreadlines().
Guido van Rossum [Tue, 22 May 2001 16:48:37 +0000 (16:48 +0000)]
file_getiter(): make iter(file) be equivalent to file.xreadlines().
This should be faster.

This means:

(1) "for line in file:" won't work if the xreadlines module can't be
    imported.

(2) The body of "for line in file:" shouldn't use the file directly;
    the effects (e.g. of file.readline(), file.seek() or even
    file.tell()) would be undefined because of the buffering that goes
    on in the xreadlines module.

24 years agoMigrate the strop test to PyUnit.
Fred Drake [Tue, 22 May 2001 16:44:33 +0000 (16:44 +0000)]
Migrate the strop test to PyUnit.

24 years agoIterator support: made the xreadlines object its own iterator. This
Guido van Rossum [Tue, 22 May 2001 16:41:32 +0000 (16:41 +0000)]
Iterator support: made the xreadlines object its own iterator.  This
ought to be faster.

24 years agocreate_message(): When os.link() doesn't exist, make a copy of the msg
Tim Peters [Tue, 22 May 2001 16:29:01 +0000 (16:29 +0000)]
create_message():  When os.link() doesn't exist, make a copy of the msg
instead.  Allows this test to finish on Windows again.

24 years ago- calendar.py uses month and day names based on the current locale.
Barry Warsaw [Tue, 22 May 2001 16:00:10 +0000 (16:00 +0000)]
- calendar.py uses month and day names based on the current locale.

24 years agoApplication of patch #401842 by Denis S. Otkidach to support
Barry Warsaw [Tue, 22 May 2001 15:58:30 +0000 (15:58 +0000)]
Application of patch #401842 by Denis S. Otkidach to support
localization of month and day names.

24 years agoCorrect the sense of a couple of conditional compilations -- used #ifndef
Fred Drake [Tue, 22 May 2001 15:44:15 +0000 (15:44 +0000)]
Correct the sense of a couple of conditional compilations -- used #ifndef
when #ifdef was needed.

This closes (reallu!) SF bug #417418.

24 years agoUpdate to add get() and setdefault() as supported mapping operations, and
Fred Drake [Tue, 22 May 2001 15:12:46 +0000 (15:12 +0000)]
Update to add get() and setdefault() as supported mapping operations, and
add a list of the mapping methods which are not supported (per Barry's
comments).

24 years agoAdd tests for the new .get() and .setdefault() methods of rfc822.Message
Fred Drake [Tue, 22 May 2001 15:02:19 +0000 (15:02 +0000)]
Add tests for the new .get() and .setdefault() methods of rfc822.Message
objects.

24 years agoAdded .get() and .setdefault() support to rfc822.Message.
Fred Drake [Tue, 22 May 2001 14:58:10 +0000 (14:58 +0000)]
Added .get() and .setdefault() support to rfc822.Message.

24 years agoAdd some clarifications about the mapping interface presented by
Fred Drake [Tue, 22 May 2001 14:36:30 +0000 (14:36 +0000)]
Add some clarifications about the mapping interface presented by
rfc822.Message objects, based on comments from Barry.

24 years agoFixed a nasty slowdown in imports in frozen applications: the shortcut
Jack Jansen [Tue, 22 May 2001 14:13:02 +0000 (14:13 +0000)]
Fixed a nasty slowdown in imports in frozen applications: the shortcut
for loading modules from the application resource fork stopped working
when sys.path component normalization was implemented. Comparison
of sys.path components is now done by FSSpec in stead of by pathname.

24 years agoNew test adapted from the ancient Demo/threads/bug.py.
Tim Peters [Tue, 22 May 2001 09:34:27 +0000 (09:34 +0000)]
New test adapted from the ancient Demo/threads/bug.py.

ICK ALERT:  read the long comment block before run_the_test().  It was
almost impossible to get this to run without instant deadlock, and the
solution here sucks on several counts.  If you can dream up a better way,
let me know!

24 years agoAdded NEWS item for the UTF-16 change.
Marc-André Lemburg [Tue, 22 May 2001 08:58:23 +0000 (08:58 +0000)]
Added NEWS item for the UTF-16 change.

24 years agoChanged all the examples with ugly platform-dependent float output to use
Tim Peters [Tue, 22 May 2001 06:54:14 +0000 (06:54 +0000)]
Changed all the examples with ugly platform-dependent float output to use
numbers that display nicely after repr().  From much doctest experience
with the same trick, I believe people find examples with simple fractions
easier to understand too:  they can usually check the results in their
head, and so feel confident about what they're seeing.  Not even I get a
warm feeling from a result that looks like 70330.345024097141 ...

24 years agoinit_name_op(): add (void) to the argument list to make it a valid
Guido van Rossum [Tue, 22 May 2001 02:33:08 +0000 (02:33 +0000)]
init_name_op(): add (void) to the argument list to make it a valid
prototype, for gcc -Wstrict-prototypes.

24 years agoAdd a "See also" section with useful links. More should be added giving
Fred Drake [Mon, 21 May 2001 21:23:01 +0000 (21:23 +0000)]
Add a "See also" section with useful links.  More should be added giving
pointers to information about the other mailbox formats; if anyone can
provide the information needed, please let me know!

24 years agoRemove all files of expected output that contain only the name of the
Fred Drake [Mon, 21 May 2001 21:12:10 +0000 (21:12 +0000)]
Remove all files of expected output that contain only the name of the
test; there is no need to store this in a file if the actual test code
does not produce any output.

24 years agoIf the file containing expected output does not exist, assume that it
Fred Drake [Mon, 21 May 2001 21:08:12 +0000 (21:08 +0000)]
If the file containing expected output does not exist, assume that it
contains a single line of text giving the name of the output file.  This
covers all tests that do not actually produce any output in the test code.

24 years agoPatch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling [Mon, 21 May 2001 20:48:09 +0000 (20:48 +0000)]
Patch #411055 from MvL: import each extension after building it, and
    delete ones that can't be imported due to missing symbols or other
    causes.

24 years agoTrim out some cruft
Andrew M. Kuchling [Mon, 21 May 2001 20:44:48 +0000 (20:44 +0000)]
Trim out some cruft

24 years agoFix bug #418369: typo in bdist_rpm
Andrew M. Kuchling [Mon, 21 May 2001 20:34:38 +0000 (20:34 +0000)]
Fix bug #418369: typo in bdist_rpm

24 years agoThis patch changes the behaviour of the UTF-16 codec family. Only the
Marc-André Lemburg [Mon, 21 May 2001 20:30:15 +0000 (20:30 +0000)]
This patch changes the behaviour of the UTF-16 codec family. Only the
UTF-16 codec will now interpret and remove a *leading* BOM mark. Sub-
sequent BOM characters are no longer interpreted and removed.
UTF-16-LE and -BE pass through all BOM mark characters.

These changes should get the UTF-16 codec more in line with what
the Unicode FAQ recommends w/r to BOM marks.

24 years agoFix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling [Mon, 21 May 2001 20:29:27 +0000 (20:29 +0000)]
Fix bug #232619: fix misleading warning on installing to lib-dynload

24 years agoRe-write the mailbox test suite to use PyUnit. Cover a lot more ground
Fred Drake [Mon, 21 May 2001 20:23:21 +0000 (20:23 +0000)]
Re-write the mailbox test suite to use PyUnit.  Cover a lot more ground
for the Maildir mailbox format.  This still does not address other mailbox
formats.

24 years agoparse_declaration(): be more lenient in what we accept. We now
Guido van Rossum [Mon, 21 May 2001 20:17:17 +0000 (20:17 +0000)]
parse_declaration(): be more lenient in what we accept.  We now
basically accept <!...> where the dots can be single- or double-quoted
strings or any other character except >.

Background: I found a real-life example that failed to parse with
the old assumption: http://www.opensource.org/licenses/jabberpl.html
contains a few constructs of the form <![if !supportLists]>...<![endif]>.

24 years agomain(): default-domain argument to getopt.getopt() was missing a = to
Barry Warsaw [Mon, 21 May 2001 19:58:23 +0000 (19:58 +0000)]
main(): default-domain argument to getopt.getopt() was missing a = to
indicate it took an argument.  This closes SF patch #402223 by Bastian
Kleineidam.

24 years ago__addentry(): add optional keyword arg `isdocstring' which is a flag
Barry Warsaw [Mon, 21 May 2001 19:51:26 +0000 (19:51 +0000)]
__addentry(): add optional keyword arg `isdocstring' which is a flag
indicating whether the entry was extracted from a docstring or not.

write(): If any of the locations of a string appearance came from a
docstring, add a comment such as

#. docstring

before the references (after a suggestion by Martin von Loewis).

24 years agowrite(): A patch inspired by Tokio Kikuchi that sorts location entries
Barry Warsaw [Mon, 21 May 2001 19:35:20 +0000 (19:35 +0000)]
write(): A patch inspired by Tokio Kikuchi that sorts location entries
first by filename and then by line number.  Closes SF patch #425821.

Also, fixes a problem with duplicate entries.

24 years agoUpdate output to reflect additional precision produced by the repr() of
Fred Drake [Mon, 21 May 2001 16:55:39 +0000 (16:55 +0000)]
Update output to reflect additional precision produced by the repr() of
floating point numbers in an interactive example.

Added comment to help explain control flow in the example code showing
how to check if a number is prime.

This closes SF bugs 419434 and 424552.

24 years agoAdd documentation for Py_Main() and PyThreadState_GetDict().
Fred Drake [Mon, 21 May 2001 15:56:55 +0000 (15:56 +0000)]
Add documentation for Py_Main() and PyThreadState_GetDict().

24 years agoTypo: "that" --> "than"
Fred Drake [Mon, 21 May 2001 15:03:35 +0000 (15:03 +0000)]
Typo: "that" --> "than"
This closes SF bug #425320.

24 years agoSF bug #425836: Reference leak in filter().
Tim Peters [Mon, 21 May 2001 08:07:05 +0000 (08:07 +0000)]
SF bug #425836:  Reference leak in filter().
Mark Hammond claimed that the iterized filter() forgot to decref the
iterator upon return.  He was right!

24 years agoAdd :method info to the PyArg_ParseTuple() format strings for poll objects.
Fred Drake [Mon, 21 May 2001 03:29:05 +0000 (03:29 +0000)]
Add :method info to the PyArg_ParseTuple() format strings for poll objects.

24 years agoFix bug in smtplib example: the prompt said to end the message with ^D,
Fred Drake [Sun, 20 May 2001 12:26:04 +0000 (12:26 +0000)]
Fix bug in smtplib example: the prompt said to end the message with ^D,
but doing so raised EOFError.  This makes it work as advertised and
converts to string methods where reasonable.

This closes SF bug #424776.

24 years agoGet Aahz listed correctly using his legal/professional name.
Fred Drake [Sun, 20 May 2001 05:29:01 +0000 (05:29 +0000)]
Get Aahz listed correctly using his legal/professional name.

24 years agoAdd another item
Andrew M. Kuchling [Sat, 19 May 2001 19:35:46 +0000 (19:35 +0000)]
Add another item

24 years agoGenerate prototype-style function headers in stead of K&R style. Makes life easier...
Jack Jansen [Sat, 19 May 2001 13:59:18 +0000 (13:59 +0000)]
Generate prototype-style function headers in stead of K&R style. Makes life easier with gcc -Wstrict-function-prototypes.

24 years agoAnother include Carbon/Carbon.h
Jack Jansen [Sat, 19 May 2001 12:57:22 +0000 (12:57 +0000)]
Another include Carbon/Carbon.h

24 years agoMoved PyMac_GetFullPath from macgetargv.c to macglue.c. It should
Jack Jansen [Sat, 19 May 2001 12:55:57 +0000 (12:55 +0000)]
Moved PyMac_GetFullPath from macgetargv.c to macglue.c. It should
have been there in the first place.

24 years agoIfdeffed a few more sections. All functionality that is relevant on MacOSX
Jack Jansen [Sat, 19 May 2001 12:50:05 +0000 (12:50 +0000)]
Ifdeffed a few more sections. All functionality that is relevant on MacOSX
now appears to work.

24 years agoInclude Carbon/Carbon.h in stead of universal headers, if appropriate.
Jack Jansen [Sat, 19 May 2001 12:34:59 +0000 (12:34 +0000)]
Include Carbon/Carbon.h in stead of universal headers, if appropriate.
Test for TARGET_API_MAC_OS8 in stead of !TARGET_API_MAC_CARBON where
appropriate.

24 years agoinclude Carbon/Carbon.h in stead of universal headers, if appropriate.
Jack Jansen [Sat, 19 May 2001 12:32:39 +0000 (12:32 +0000)]
include Carbon/Carbon.h in stead of universal headers, if appropriate.

24 years agoMerged mactoolboxglue.c into macglue.c. A later step will be to separate out
Jack Jansen [Sat, 19 May 2001 12:31:09 +0000 (12:31 +0000)]
Merged mactoolboxglue.c into macglue.c. A later step will be to separate out
the stuff that is only needed on classic-MacOS.

24 years agoBugfix candidate.
Tim Peters [Sat, 19 May 2001 07:04:38 +0000 (07:04 +0000)]
Bugfix candidate.
Two exceedingly unlikely errors in dictresize():
1. The loop for finding the new size had an off-by-one error at the
   end (could over-index the polys[] vector).
2. The polys[] vector ended with a 0, apparently intended as a sentinel
   value but never used as such; i.e., it was never checked, so 0 could
   have been used *as* a polynomial.
Neither bug could trigger unless a dict grew to 2**30 slots; since that
would consume at least 12GB of memory just to hold the dict pointers,
I'm betting it's not the cause of the bug Fred's tracking down <wink>.

24 years agoUpdate a comment.
Fred Drake [Fri, 18 May 2001 21:50:02 +0000 (21:50 +0000)]
Update a comment.

24 years agoSimple conversion to PyUnit.
Fred Drake [Fri, 18 May 2001 21:45:35 +0000 (21:45 +0000)]
Simple conversion to PyUnit.

24 years agoSimple conversion to PyUnit.
Fred Drake [Fri, 18 May 2001 21:38:52 +0000 (21:38 +0000)]
Simple conversion to PyUnit.

24 years agoFix whitespace botch.
Fred Drake [Fri, 18 May 2001 21:03:40 +0000 (21:03 +0000)]
Fix whitespace botch.

24 years agovgetargs1() and vgetargskeywords(): Replace uses of PyTuple_Size() and
Jeremy Hylton [Fri, 18 May 2001 20:57:38 +0000 (20:57 +0000)]
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().

24 years agoAdd a second special case to the inline function call code in eval_code2().
Jeremy Hylton [Fri, 18 May 2001 20:53:14 +0000 (20:53 +0000)]
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.

24 years agoAdded test suite for the new HTMLParser module, originally from the
Fred Drake [Fri, 18 May 2001 15:32:59 +0000 (15:32 +0000)]
Added test suite for the new HTMLParser module, originally from the
TAL/PageTemplate package for Zope.  This only needed a little boilerplate
change; the tests themselves are unchanged.

24 years agoA much improved HTML parser -- a replacement for sgmllib. The API is
Guido van Rossum [Fri, 18 May 2001 14:50:52 +0000 (14:50 +0000)]
A much improved HTML parser -- a replacement for sgmllib.  The API is
derived from but not quite compatible with that of sgmllib, so it's a
new file.  I suppose it needs documentation, and htmllib needs to be
changed to use this instead of sgmllib, and sgmllib needs to be
declared obsolete.  But that can all be done later.

This code was first published as part of TAL (part of Zope Page
Templates), but that was strongly based on sgmllib anyway.  Authors
are Fred drake and Guido van Rossum.

24 years agoSpeed dictresize by collapsing its two passes into one; the reason given
Tim Peters [Thu, 17 May 2001 22:25:34 +0000 (22:25 +0000)]
Speed dictresize by collapsing its two passes into one; the reason given
in the comments for using two passes was bogus, as the only object that
can get decref'ed due to the copy is the dummy key, and decref'ing dummy
can't have side effects (for one thing, dummy is immortal!  for another,
it's a string object, not a potentially dangerous user-defined object).

24 years agoAdded pymactoolboxglue.c and changed the exported symbols having to do with this.
Jack Jansen [Thu, 17 May 2001 22:14:36 +0000 (22:14 +0000)]
Added pymactoolboxglue.c and changed the exported symbols having to do with this.

24 years agoDynamically loaded toolbox modules don't need to link against each other anymore...
Jack Jansen [Thu, 17 May 2001 22:12:55 +0000 (22:12 +0000)]
Dynamically loaded toolbox modules don't need to link against each other anymore, due to the new glue code that ties them together.

24 years agoGlue code to connect obj_New and obj_Convert routines (the PyArg_Parse and Py_BuildTu...
Jack Jansen [Thu, 17 May 2001 22:11:44 +0000 (22:11 +0000)]
Glue code to connect obj_New and obj_Convert routines (the PyArg_Parse and Py_BuildTuple helpers) from one dynamically imported module to another.

24 years agoFirst step in porting MacPython modules to OSX/unix: break all references between...
Jack Jansen [Thu, 17 May 2001 21:58:34 +0000 (21:58 +0000)]
First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers.

And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again.

24 years agoFixed botched indent in _init_mac() code. (It may never be executed,
Guido van Rossum [Thu, 17 May 2001 15:03:14 +0000 (15:03 +0000)]
Fixed botched indent in _init_mac() code.  (It may never be executed,
but it still can't have any syntax errors.  Went a little too fast
there, Jack? :-)

24 years agoMade distutils understand the MacPython Carbon runtime model. Distutils will build...
Jack Jansen [Thu, 17 May 2001 12:52:01 +0000 (12:52 +0000)]
Made distutils understand the MacPython Carbon runtime model. Distutils will build for the runtime model you are currently using for the interpreter.

24 years agoFixed macroman<->latin1 conversion. Some chars don't
Jack Jansen [Thu, 17 May 2001 12:45:13 +0000 (12:45 +0000)]
Fixed macroman<->latin1 conversion. Some chars don't
exist in latin1, but at least the roundtrip results in the
same macroman characters.

24 years agoFixed macroman<->latin1 conversion. Some characters don't exist in latin1, but at...
Jack Jansen [Thu, 17 May 2001 12:35:13 +0000 (12:35 +0000)]
Fixed macroman<->latin1 conversion. Some characters don't exist in latin1, but at least the roundtrip gives
the correct macroman characters again.

24 years agoMoved the encoding map building logic from the individual mapping
Marc-André Lemburg [Wed, 16 May 2001 09:41:45 +0000 (09:41 +0000)]
Moved the encoding map building logic from the individual mapping
codec files to codecs.py and added logic so that multi mappings
in the decoding maps now result in mappings to None (undefined mapping)
in the encoding maps.

24 years agoBah, somehow the macroman<->iso-latin-1 translation got lost during the merge. Checki...
Jack Jansen [Tue, 15 May 2001 20:22:08 +0000 (20:22 +0000)]
Bah, somehow the macroman<->iso-latin-1 translation got lost during the merge. Checking in one fixed file to make sure MacCVS Pro isn't the problem. If it isn't a flurry of checkins will follow tomorrow. If it is... well...

24 years agoSpeed tuple comparisons in two ways:
Tim Peters [Tue, 15 May 2001 20:12:59 +0000 (20:12 +0000)]
Speed tuple comparisons in two ways:
1. Omit the early-out EQ/NE "lengths different?" test.  Was unable to find
   any real code where it triggered, but it always costs.  The same is not
   true of list richcmps, where different-size lists appeared to get
   compared about half the time.
2. Because tuples are immutable, there's no need to refetch the lengths of
   both tuples from memory again on each loop trip.

BUG ALERT:  The tuple (and list) richcmp algorithm is arguably wrong,
because it won't believe there's any difference unless Py_EQ returns false
for some corresponding elements:

>>> class C:
...     def __lt__(x, y): return 1
...     __eq__ = __lt__
...
>>> C() < C()
1
>>> (C(),) < (C(),)
0
>>>

That doesn't make sense -- provided you believe the defn. of C makes sense.

24 years agoAdd NEWS item for new string methods.
Marc-André Lemburg [Tue, 15 May 2001 18:38:45 +0000 (18:38 +0000)]
Add NEWS item for new string methods.

24 years agoJust changed "x,y" to "x, y" everywhere (i.e., inserted horizontal space
Tim Peters [Tue, 15 May 2001 17:19:16 +0000 (17:19 +0000)]
Just changed "x,y" to "x, y" everywhere (i.e., inserted horizontal space
after commas that didn't have any).

24 years agoAdd quoted-printable codec
Guido van Rossum [Tue, 15 May 2001 15:34:07 +0000 (15:34 +0000)]
Add quoted-printable codec

24 years agoBeef up the unicode() description a bit, based on material from AMK's
Fred Drake [Tue, 15 May 2001 15:27:53 +0000 (15:27 +0000)]
Beef up the unicode() description a bit, based on material from AMK's
"What's New in Python ..." documents.

24 years agoabspath(): Fix inconsistent indentation.
Fred Drake [Tue, 15 May 2001 15:23:01 +0000 (15:23 +0000)]
abspath():  Fix inconsistent indentation.

24 years agoThis patch changes the way the string .encode() method works slightly
Marc-André Lemburg [Tue, 15 May 2001 12:00:02 +0000 (12:00 +0000)]
This patch changes the way the string .encode() method works slightly
and introduces a new method .decode().

The major change is that strg.encode() will no longer try to convert
Unicode returns from the codec into a string, but instead pass along
the Unicode object as-is. The same is now true for all other codec
return types. The underlying C APIs were changed accordingly.

Note that even though this does have the potential of breaking
existing code, the chances are low since conversion from Unicode
previously took place using the default encoding which is normally
set to ASCII rendering this auto-conversion mechanism useless for
most Unicode encodings.

The good news is that you can now use .encode() and .decode() with
much greater ease and that the door was opened for better accessibility
of the builtin codecs.

As demonstration of the new feature, the patch includes a few new
codecs which allow string to string encoding and decoding (rot13,
hex, zip, uu, base64).

Written by Marc-Andre Lemburg. Copyright assigned to the PSF.

24 years agoAdd warnings to the strop module, for to those functions that really
Guido van Rossum [Tue, 15 May 2001 02:14:44 +0000 (02:14 +0000)]
Add warnings to the strop module, for to those functions that really
*are* obsolete; three variables and the maketrans() function are not
(yet) obsolete.

Add a compensating warnings.filterwarnings() call to test_strop.py.

Add this to the NEWS.

24 years agoIgnore 'build' and 'Makefile.pre'.
Guido van Rossum [Tue, 15 May 2001 01:53:40 +0000 (01:53 +0000)]
Ignore 'build' and 'Makefile.pre'.

24 years agoFix new compiler warnings. Also boost "start" from (C) int to long and
Tim Peters [Mon, 14 May 2001 23:19:12 +0000 (23:19 +0000)]
Fix new compiler warnings.  Also boost "start" from (C) int to long and
return a (C) long:  PyArg_ParseTuple and Py_BuildValue may not let us get
at the size_t we really want, but C int is clearly too small for a 64-bit
box, and both the start parameter and the return value should work for
large mapped files even on 32-bit boxes.  The code really needs to be
rethought from scratch (not by me, though ...).

24 years agoSF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen.
Tim Peters [Mon, 14 May 2001 22:32:33 +0000 (22:32 +0000)]
SF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen.

24 years agofcntl.ioctl(): Update error message; necessity noted by Michael Hudson.
Fred Drake [Mon, 14 May 2001 21:02:36 +0000 (21:02 +0000)]
fcntl.ioctl():  Update error message; necessity noted by Michael Hudson.

24 years agoConvert a couple of comments to docstrings -- PyUnit can use these when
Fred Drake [Mon, 14 May 2001 19:15:23 +0000 (19:15 +0000)]
Convert a couple of comments to docstrings -- PyUnit can use these when
the regression test is run in verbose mode.

24 years agopprint's workhorse _safe_repr() function took time quadratic in the # of
Tim Peters [Mon, 14 May 2001 18:39:41 +0000 (18:39 +0000)]
pprint's workhorse _safe_repr() function took time quadratic in the # of
elements when crunching a list, dict or tuple.  Now takes linear time
instead -- huge speedup for even moderately large containers, and the
code is notably simpler too.
Added some basic "is the output correct?" tests to test_pprint.

24 years agoConvert the pprint test to use PyUnit.
Fred Drake [Mon, 14 May 2001 17:41:20 +0000 (17:41 +0000)]
Convert the pprint test to use PyUnit.

24 years agoMake sure we include all of Python's numeric types in the data model
Fred Drake [Mon, 14 May 2001 16:04:22 +0000 (16:04 +0000)]
Make sure we include all of Python's numeric types in the data model
description, so that the introduction of complex is not a surprise.

This closes SF bug #423429.

24 years agoAdded a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compil...
Jack Jansen [Mon, 14 May 2001 15:00:38 +0000 (15:00 +0000)]
Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h.

24 years agoFix a typo, consistently spell ASCII in all caps, and insert blank
Guido van Rossum [Mon, 14 May 2001 13:53:38 +0000 (13:53 +0000)]
Fix a typo, consistently spell ASCII in all caps, and insert blank
lines between paragraphs in Mark Hammond's news item about the default
encoding in posixmodule.  Resist the temptation to reflow paragraphs.

24 years agoFix the Py_FileSystemDefaultEncoding checkin - declare the variable in a fileobject...
Mark Hammond [Mon, 14 May 2001 12:17:34 +0000 (12:17 +0000)]
Fix the Py_FileSystemDefaultEncoding checkin - declare the variable in a fileobject.h, and initialize it in bltinmodule.

24 years agoFix the .find() method for memory maps.
Greg Stein [Mon, 14 May 2001 09:32:26 +0000 (09:32 +0000)]
Fix the .find() method for memory maps.

1) it didn't obey the "start" parameter (and when it does, we must validate
   the value)
2) the return value needs to be an absolute index, rather than relative to
   some arbitrary point in the file

(checking CVS, it appears this method never worked; these changes bring it
 into line with typical .find() behavior)

24 years agoSF bug[ #423781: pprint.isrecursive() broken.
Tim Peters [Mon, 14 May 2001 07:05:58 +0000 (07:05 +0000)]
SF bug[ #423781:  pprint.isrecursive() broken.

24 years agoAdd mention of the default file system encoding for Windows.
Mark Hammond [Mon, 14 May 2001 03:09:36 +0000 (03:09 +0000)]
Add mention of the default file system encoding for Windows.

24 years agoA disgusting "fix" for the test___all__ failure under Windows.
Tim Peters [Sun, 13 May 2001 09:01:06 +0000 (09:01 +0000)]
A disgusting "fix" for the test___all__ failure under Windows.

24 years agoAdd support for Windows using "mbcs" as the default Unicode encoding when dealing...
Mark Hammond [Sun, 13 May 2001 08:04:26 +0000 (08:04 +0000)]
Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system.  As discussed on python-dev and in patch 410465.

24 years agoAggressive reordering of dict comparisons. In case of collision, it stands
Tim Peters [Sun, 13 May 2001 06:43:53 +0000 (06:43 +0000)]
Aggressive reordering of dict comparisons.  In case of collision, it stands
to reason that me_key is much more likely to match the key we're looking
for than to match dummy, and if the key is absent me_key is much more
likely to be NULL than dummy:  most dicts don't even have a dummy entry.
Running instrumented dict code over the test suite and some apps confirmed
that matching dummy was 200-300x less frequent than matching key in
practice.  So this reorders the tests to try the common case first.
It can lose if a large dict with many collisions is mostly deleted, not
resized, and then frequently searched, but that's hardly a case we
should be favoring.