]> granicus.if.org Git - python/log
python
22 years agoUse a better check for overflow from a<<b.
Guido van Rossum [Sun, 11 Aug 2002 14:04:13 +0000 (14:04 +0000)]
Use a better check for overflow from a<<b.

22 years agoAdd C API PyUnicode_FromOrdinal() which exposes unichr() at C level.
Marc-André Lemburg [Sun, 11 Aug 2002 12:23:04 +0000 (12:23 +0000)]
Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.

u'%c' will now raise a ValueError in case the argument is an
integer outside the valid range of Unicode code point ordinals.

Closes SF bug #593581.

22 years agoImplement stage B0 of PEP 237: add warnings for operations that
Guido van Rossum [Sun, 11 Aug 2002 04:24:12 +0000 (04:24 +0000)]
Implement stage B0 of PEP 237: add warnings for operations that
currently return inconsistent results for ints and longs; in
particular: hex/oct/%u/%o/%x/%X of negative short ints, and x<<n that
either loses bits or changes sign.  (No warnings for repr() of a long,
though that will also change to lose the trailing 'L' eventually.)

This introduces some warnings in the test suite; I'll take care of
those later.

22 years agotest_saveall(): Another small simplification; plus s/l/L/g.
Tim Peters [Sun, 11 Aug 2002 04:15:09 +0000 (04:15 +0000)]
test_saveall():  Another small simplification; plus s/l/L/g.
test_del(), test_del_newclass():  No need to use apply() in these.

22 years agoAnd one more simplification to test_saveall().
Tim Peters [Sat, 10 Aug 2002 21:32:16 +0000 (21:32 +0000)]
And one more simplification to test_saveall().

22 years agotest_saveall(): Simplified a little, given that we only expect one item
Tim Peters [Sat, 10 Aug 2002 21:29:56 +0000 (21:29 +0000)]
test_saveall():  Simplified a little, given that we only expect one item
in gc.garbage (so no need to loop looking for it -- it's there or it's
not).

22 years agoIf any trash happened to be sitting around waiting to get collected at
Tim Peters [Sat, 10 Aug 2002 21:20:54 +0000 (21:20 +0000)]
If any trash happened to be sitting around waiting to get collected at
the time it's called, test_saveall() made it look a leak, triggering
bogus warnings from regrtest's -l (findleaks) mode.

22 years agoConvert characters from the locale's encoding on output.
Martin v. Löwis [Sat, 10 Aug 2002 12:22:12 +0000 (12:22 +0000)]
Convert characters from the locale's encoding on output.
Reject characters outside the locale's encoding on input.

22 years agoFixed new typos, added a little info about ~sort versus "hint"s.
Tim Peters [Sat, 10 Aug 2002 07:04:01 +0000 (07:04 +0000)]
Fixed new typos, added a little info about ~sort versus "hint"s.

22 years agoClarify that the interruptable popen fixes aren't used under Win9x.
Mark Hammond [Sat, 10 Aug 2002 06:26:31 +0000 (06:26 +0000)]
Clarify that the interruptable popen fixes aren't used under Win9x.

22 years agoDisallow class assignment completely unless both old and new are heap
Guido van Rossum [Sat, 10 Aug 2002 05:42:07 +0000 (05:42 +0000)]
Disallow class assignment completely unless both old and new are heap
types.  This prevents nonsense like 2.__class__ = bool or
True.__class__ = int.

22 years ago1. Combined the base and length arrays into a single array of structs.
Tim Peters [Sat, 10 Aug 2002 05:21:15 +0000 (05:21 +0000)]
1. Combined the base and length arrays into a single array of structs.
   This is friendlier for caches.

2. Cut MIN_GALLOP to 7, but added a per-sort min_gallop vrbl that adapts
   the "get into galloping mode" threshold higher when galloping isn't
   paying, and lower when it is.  There's no known case where this hurts.
   It's (of course) neutral for /sort, \sort and =sort.  It also happens
   to be neutral for !sort.  It cuts a tiny # of compares in 3sort and +sort.
   For *sort, it reduces the # of compares to better than what this used to
   do when MIN_GALLOP was hardcoded to 10 (it did about 0.1% more *sort
   compares before, but given how close we are to the limit, this is "a
   lot"!).  %sort used to do about 1.5% more compares, and ~sort about
   3.6% more.  Here are exact counts:

 i    *sort    3sort    +sort    %sort    ~sort    !sort
15   449235    33019    33016    51328   188720    65534  before
     448885    33016    33007    50426   182083    65534  after
      0.08%    0.01%    0.03%    1.79%    3.65%    0.00%  %ch from after

16   963714    65824    65809   103409   377634   131070
     962991    65821    65808   101667   364341   131070
      0.08%    0.00%    0.00%    1.71%    3.65%    0.00%

17  2059092   131413   131362   209130   755476   262142
    2057533   131410   131361   206193   728871   262142
      0.08%    0.00%    0.00%    1.42%    3.65%    0.00%

18  4380687   262440   262460   421998  1511174   524286
    4377402   262437   262459   416347  1457945   524286
      0.08%    0.00%    0.00%    1.36%    3.65%    0.00%

19  9285709   524581   524634   848590  3022584  1048574
    9278734   524580   524633   837947  2916107  1048574
      0.08%    0.00%    0.00%    1.27%    3.65%    0.00%

20 19621118  1048960  1048942  1715806  6045418  2097150
   19606028  1048958  1048941  1694896  5832445  2097150
      0.08%    0.00%    0.00%    1.23%    3.65%    0.00%

3. Added some key asserts I overlooked before.

4. Updated the doc file.

22 years agoThe samplesort-vs-mergesort #-of-comparisons comparisons were captured
Tim Peters [Sat, 10 Aug 2002 03:04:33 +0000 (03:04 +0000)]
The samplesort-vs-mergesort #-of-comparisons comparisons were captured
before %sort was introduced.  Redid them (the numbers change, but the
conclusions don't).  Also did the samplesort counts with the released
2.2.1, as they're slightly different under the last CVS 2.3 samplesort
(some higher, some lower -- CVS had been changed to stop doing the
special-case business on recursive samplesort calls).

22 years agoFix a typo in the mktemp -> mkstemp patch.
Guido van Rossum [Sat, 10 Aug 2002 00:17:59 +0000 (00:17 +0000)]
Fix a typo in the mktemp -> mkstemp patch.

22 years agoAccomodate the packaging changes when we unpack into the dev/doc/ area
Fred Drake [Fri, 9 Aug 2002 22:56:46 +0000 (22:56 +0000)]
Accomodate the packaging changes when we unpack into the dev/doc/ area
on python.org.

22 years agoLots of changes to the packaging of the documentation, all to keep
Fred Drake [Fri, 9 Aug 2002 20:20:50 +0000 (20:20 +0000)]
Lots of changes to the packaging of the documentation, all to keep
directories clean where the packages are unpacked.  Each package now
contains a single directory, Python-Docs-<version>/, which contains the
files for that version of the documentation.

Closes SF feature request #567576.

22 years agoA tool to transform gprof(1) output into HTML, so you can click on a
Guido van Rossum [Fri, 9 Aug 2002 20:07:34 +0000 (20:07 +0000)]
A tool to transform gprof(1) output into HTML, so you can click on a
function name and go to the corresponding entry.

22 years agoWhitespace normalization.
Guido van Rossum [Fri, 9 Aug 2002 19:18:25 +0000 (19:18 +0000)]
Whitespace normalization.

22 years agoAdd tests for weakref support for generator-iterators.
Fred Drake [Fri, 9 Aug 2002 18:37:10 +0000 (18:37 +0000)]
Add tests for weakref support for generator-iterators.
Part of fixing SF bug #591704.

22 years agoAdd weakref support generator-iterators.
Fred Drake [Fri, 9 Aug 2002 18:35:52 +0000 (18:35 +0000)]
Add weakref support generator-iterators.
Part of fixing SF bug #591704.

22 years agoAdd support for the iterator protocol to weakref proxy objects.
Fred Drake [Fri, 9 Aug 2002 18:34:16 +0000 (18:34 +0000)]
Add support for the iterator protocol to weakref proxy objects.
Part of fixing SF bug #591704.

22 years agoThere's no distinction among 'user', 'group' and 'world' permissions
Tim Peters [Fri, 9 Aug 2002 18:13:51 +0000 (18:13 +0000)]
There's no distinction among 'user', 'group' and 'world' permissions
on Win32, so tests that assume there are such distinctions can't
pass.  Fiddled them to work.

22 years agoWhitespace normalization.
Tim Peters [Fri, 9 Aug 2002 18:01:01 +0000 (18:01 +0000)]
Whitespace normalization.

22 years agoFor new-style classes, we can now test for tp_del instead of asking
Guido van Rossum [Fri, 9 Aug 2002 17:39:14 +0000 (17:39 +0000)]
For new-style classes, we can now test for tp_del instead of asking
for a __del__ attribute, to see if there's a finalizer.

22 years agoTest finalizers and GC from inside __del__ for new classes.
Guido van Rossum [Fri, 9 Aug 2002 17:38:16 +0000 (17:38 +0000)]
Test finalizers and GC from inside __del__ for new classes.

22 years agoCredit to Oren for the file-iterator patch.
Guido van Rossum [Fri, 9 Aug 2002 17:17:07 +0000 (17:17 +0000)]
Credit to Oren for the file-iterator patch.

22 years agoNews about the tempfile rewrite.
Guido van Rossum [Fri, 9 Aug 2002 17:16:30 +0000 (17:16 +0000)]
News about the tempfile rewrite.

22 years agoMassive changes from SF 589982 (tempfile.py rewrite, by Zack
Guido van Rossum [Fri, 9 Aug 2002 16:38:32 +0000 (16:38 +0000)]
Massive changes from SF 589982 (tempfile.py rewrite, by Zack
Weinberg).  This changes all uses of deprecated tempfile functions to
the recommended ones.

22 years agoDoc portion of SF 589982 (tempfile.py rewrite, by Zack Weinberg).
Guido van Rossum [Fri, 9 Aug 2002 16:16:30 +0000 (16:16 +0000)]
Doc portion of SF 589982 (tempfile.py rewrite, by Zack Weinberg).

Fred, please review!

22 years agoCheck-in of the most essential parts of SF 589982 (tempfile.py
Guido van Rossum [Fri, 9 Aug 2002 16:14:33 +0000 (16:14 +0000)]
Check-in of the most essential parts of SF 589982 (tempfile.py
rewrite, by Zack Weinberg).  This replaces most code in tempfile.py
(please review!!!) and adds extensive unit tests for it.

This will cause some warnings in the test suite; I'll check those in
soon, and also the docs.

22 years agoTest for Neil's fix to correctly invoke __rmul__.
Guido van Rossum [Fri, 9 Aug 2002 16:11:37 +0000 (16:11 +0000)]
Test for Neil's fix to correctly invoke __rmul__.

22 years agoNews about Neil's fix to correctly invoke __rmul__.
Guido van Rossum [Fri, 9 Aug 2002 15:57:34 +0000 (15:57 +0000)]
News about Neil's fix to correctly invoke __rmul__.

22 years agoUnicode replace() method with empty pattern argument should fail, like
Guido van Rossum [Fri, 9 Aug 2002 15:36:48 +0000 (15:36 +0000)]
Unicode replace() method with empty pattern argument should fail, like
it does for 8-bit strings.

22 years agoOnly call sq_repeat if the object does not have a nb_multiply slot. One
Neil Schemenauer [Fri, 9 Aug 2002 15:20:48 +0000 (15:20 +0000)]
Only call sq_repeat if the object does not have a nb_multiply slot.  One
example of where this changes behavior is when a new-style instance
defines '__mul__' and '__rmul__' and is multiplied by an int.  Before the
change the '__rmul__' method is never called, even if the int is the
left operand.

22 years agoNew entries to track the DOM API growth. These match names exposed in
Fred Drake [Fri, 9 Aug 2002 14:57:55 +0000 (14:57 +0000)]
New entries to track the DOM API growth.  These match names exposed in
PyXML 0.8.

22 years agoWhen installing the "python" link in bindir also test for a pre-existing
Jack Jansen [Fri, 9 Aug 2002 14:42:57 +0000 (14:42 +0000)]
When installing the "python" link in bindir also test for a pre-existing
symlink and remove it.

22 years ago- Precompile py files in Mac subtree after installing
Jack Jansen [Fri, 9 Aug 2002 14:15:46 +0000 (14:15 +0000)]
- Precompile py files in Mac subtree after installing
- Pre-cache .rsrc files in Mac subtree after installing
- Fixed nameclash in Make variables

22 years ago- Check not only that cache file exists, but also that it is newer than
Jack Jansen [Fri, 9 Aug 2002 13:44:03 +0000 (13:44 +0000)]
- Check not only that cache file exists, but also that it is newer than
  the applesingle file.
- Added optional verbose option for cachersrc tool.

22 years agoTool to pre-created cached .rsrc.df.rsrc files in the Lib directories,
Jack Jansen [Fri, 9 Aug 2002 13:42:55 +0000 (13:42 +0000)]
Tool to pre-created cached .rsrc.df.rsrc files in the Lib directories,
similar to compileall.py.

22 years agoDocument that -u puts stdin, stdout, and stderr in binary mode.
Sjoerd Mullender [Fri, 9 Aug 2002 13:37:31 +0000 (13:37 +0000)]
Document that -u puts stdin, stdout, and stderr in binary mode.

22 years agoOn Cygwin, put stdin, stderr, and stdout in binary mode when the -u
Sjoerd Mullender [Fri, 9 Aug 2002 13:35:18 +0000 (13:35 +0000)]
On Cygwin, put stdin, stderr, and stdout in binary mode when the -u
flag is given (to mimic native Windows).

22 years agoObsolete now that there's a python implementation of strptime in the
Jack Jansen [Fri, 9 Aug 2002 10:22:11 +0000 (10:22 +0000)]
Obsolete now that there's a python implementation of strptime in the
standard lib.

22 years agoPatch by Russel Owen: if we have command line arguments zap pyc files
Jack Jansen [Fri, 9 Aug 2002 10:17:28 +0000 (10:17 +0000)]
Patch by Russel Owen: if we have command line arguments zap pyc files
in the directories given.

22 years agoFix to ensure consistent 'repr' and 'str' results between Python
Steve Purcell [Fri, 9 Aug 2002 09:46:23 +0000 (09:46 +0000)]
Fix to ensure consistent 'repr' and 'str' results between Python
versions, since 'repr(new_style_class) != repr(classic_class)'.
Suggested by Jeremy Hylton.

22 years agoDepracated some non-carbon modules.
Jack Jansen [Fri, 9 Aug 2002 09:03:31 +0000 (09:03 +0000)]
Depracated some non-carbon modules.

22 years agoThis file should have gone long ago.
Jack Jansen [Fri, 9 Aug 2002 09:02:01 +0000 (09:02 +0000)]
This file should have gone long ago.

22 years agoRepaired a braino in the description of bad minrun values.
Tim Peters [Fri, 9 Aug 2002 05:06:44 +0000 (05:06 +0000)]
Repaired a braino in the description of bad minrun values.

22 years agoSF bug #592645 fix memory leak in socket.getaddrinfo
Neal Norwitz [Fri, 9 Aug 2002 03:37:42 +0000 (03:37 +0000)]
SF bug #592645 fix memory leak in socket.getaddrinfo

22 years agoUpdate the text on the Expat module and library.
Fred Drake [Fri, 9 Aug 2002 02:39:13 +0000 (02:39 +0000)]
Update the text on the Expat module and library.

22 years agoMajor speedup for new-style class creation. Turns out there was some
Guido van Rossum [Fri, 9 Aug 2002 02:14:34 +0000 (02:14 +0000)]
Major speedup for new-style class creation.  Turns out there was some
trampolining going on with the tp_new descriptor, where the inherited
PyType_GenericNew was overwritten with the much slower slot_tp_new
which would end up calling tp_new_wrapper which would eventually call
PyType_GenericNew.  Add a special case for this to update_one_slot().

XXX Hope there isn't a loophole in this.  I'll buy the first person to
point out a bug in the reasoning a beer.

Backport candidate (but I won't do it).

22 years agoMoved inplace add and multiply methods from UserString to MutableString.
Raymond Hettinger [Fri, 9 Aug 2002 01:37:06 +0000 (01:37 +0000)]
Moved inplace add and multiply methods from UserString to MutableString.
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.

22 years agoMoved special case for tuples from iterobject.c to
Raymond Hettinger [Fri, 9 Aug 2002 01:30:17 +0000 (01:30 +0000)]
Moved special case for tuples from iterobject.c to
tupleobject.c. Makes the code in iterobject.c cleaner
and speeds-up the general case by not checking for
tuples everytime.   SF Patch #592065.

22 years agoRevised the test suite for 'contains' to use the test() function argument
Raymond Hettinger [Fri, 9 Aug 2002 00:43:38 +0000 (00:43 +0000)]
Revised the test suite for 'contains' to use the test() function argument
rather than vereq().  While it was effectively testing regular strings, it
ignored the test() function argument when called by test_userstring.py.

22 years agoBy popular demand the frameworkinstall target now installs everything:
Jack Jansen [Fri, 9 Aug 2002 00:18:21 +0000 (00:18 +0000)]
By popular demand the frameworkinstall target now installs everything:
the framework, the MacOSX apps and the unix tools.
Most of the hard work is done by Mac/OSX/Makefile.

Also, it should now be possible to install in a different directory,
such as /tmp/dist/Library/Frameworks, for building binary installers.
The fink crowd wanted this.

22 years agoSignificant speedup in new-style object creation: in slot_tp_new(),
Guido van Rossum [Thu, 8 Aug 2002 21:57:53 +0000 (21:57 +0000)]
Significant speedup in new-style object creation: in slot_tp_new(),
intern the string "__new__" so we can call PyObject_GetAttr() rather
than PyObject_GetAttrString().  (Though it's a mystery why slot_tp_new
is being called when a class doesn't define __new__.  I'll look into
that tomorrow.)

2.2 backport candidate (but I won't do it).

22 years agoUse hex escape for non-ascii chars, now that the parser wants that.
Jack Jansen [Thu, 8 Aug 2002 21:16:56 +0000 (21:16 +0000)]
Use hex escape for non-ascii chars, now that the parser wants that.
Good thing, too: some of the characters had been mangled by OS9->CVS->OSX
roundtrips.

22 years agoA modest speedup of object deallocation. call_finalizer() did rather
Guido van Rossum [Thu, 8 Aug 2002 20:55:20 +0000 (20:55 +0000)]
A modest speedup of object deallocation.  call_finalizer() did rather
a lot of work: it had to save and restore the current exception around
a call to lookup_maybe(), because that could fail in rare cases, and
most objects don't have a __del__ method, so the whole exercise was
usually a waste of time.  Changed this to cache the __del__ method in
the type object just like all other special methods, in a new slot
tp_del.  So now subtype_dealloc() can test whether tp_del is NULL and
skip the whole exercise if it is.  The new slot doesn't need a new
flag bit: subtype_dealloc() is only called if the type was dynamically
allocated by type_new(), so it's guaranteed to have all current slots.
Types defined in C cannot fill in tp_del with a function of their own,
so there's no corresponding "wrapper".  (That functionality is already
available through tp_dealloc.)

22 years agoThe other half of the patches added to SF patch 555085 by A I
Guido van Rossum [Thu, 8 Aug 2002 20:39:30 +0000 (20:39 +0000)]
The other half of the patches added to SF patch 555085 by A I
MacIntyre.  At least on OS/2, a subsequent connect() on a nonblocking
socket returns errno==EISCONN to indicate success.  This seems
harmless on Unix.

22 years agoClean up some docstrings. Some docstrings didn't show their return
Guido van Rossum [Thu, 8 Aug 2002 20:37:08 +0000 (20:37 +0000)]
Clean up some docstrings.  Some docstrings didn't show their return
value; others were inconsistent in what to name the argument or return
value; a few module-global functions had "socket." in front of their
name, against convention.

22 years agotestSendAll(): loop until all data is read; this was necessary at
Guido van Rossum [Thu, 8 Aug 2002 20:28:34 +0000 (20:28 +0000)]
testSendAll(): loop until all data is read; this was necessary at
least on OS/2 (see note on SF patch 555085 by A I MacIntyre) but
looks like the test *could* fail on any other platform too -- there's
no guarantee that recv() reads all data.

22 years agoWhitespace normalization.
Tim Peters [Thu, 8 Aug 2002 20:19:19 +0000 (20:19 +0000)]
Whitespace normalization.

22 years agoDelete junk attributes left behind by _socketobject class construction.
Tim Peters [Thu, 8 Aug 2002 20:07:03 +0000 (20:07 +0000)]
Delete junk attributes left behind by _socketobject class construction.

22 years agoPatch #588561: Cygwin _hotshot patch
Jason Tishler [Thu, 8 Aug 2002 19:46:15 +0000 (19:46 +0000)]
Patch #588561: Cygwin _hotshot patch

YA Cygwin module patch very similar to other patches
that I have submitted.  I tested under Cygwin and Red
Hat Linux 7.1.

22 years agoThe _socketobject class has no need for a __del__ method: all it did was
Guido van Rossum [Thu, 8 Aug 2002 18:11:36 +0000 (18:11 +0000)]
The _socketobject class has no need for a __del__ method: all it did was
to delete the reference to self._sock, and the regular destructor will
do that just fine.  This made some hacks in close() unnecessary.

The _fileobject class still has a __del__ method, because it must flush.

22 years agoOK, one more hack: speed up the case of readline() in unbuffered mode.
Guido van Rossum [Thu, 8 Aug 2002 17:34:19 +0000 (17:34 +0000)]
OK, one more hack: speed up the case of readline() in unbuffered mode.
This is important IMO because httplib reads the headers this way.

22 years agoAnother refactoring of read() and readline(), this time based on the
Guido van Rossum [Thu, 8 Aug 2002 17:16:09 +0000 (17:16 +0000)]
Another refactoring of read() and readline(), this time based on the
observation that _rbuf could never have more than one string in it.
So make _rbuf a string.  The code branches for size<0 and size>=0
are completely separate now, both in read() and in readline().

I checked for tabs this time. :-)

22 years agoExtend __all__ with the exports list of the _ssl module.
Guido van Rossum [Thu, 8 Aug 2002 15:25:28 +0000 (15:25 +0000)]
Extend __all__ with the exports list of the _ssl module.

22 years agoOops, stupid tabs. Sorry again.
Guido van Rossum [Thu, 8 Aug 2002 15:22:12 +0000 (15:22 +0000)]
Oops, stupid tabs.  Sorry again.

22 years agoAnother refactoring. Changed 'socket' from being a factory function
Guido van Rossum [Thu, 8 Aug 2002 15:16:20 +0000 (15:16 +0000)]
Another refactoring.  Changed 'socket' from being a factory function
to being a new-style class, to be more similar to the socket class
in the _socket module; it is now the same as the _socketobject class.
Added __slots__.  Added docstrings, copied from the real socket class
where possible.

The _fileobject class is now also a new-style class with __slots__
(though without docstrings).  The mode, name, softspace, bufsize and
closed attributes are properly supported (closed as a property; name
as a class attributes; the softspace, mode and bufsize as slots).

22 years agoAdd module-wide "__metaclass__ = type", as requested by Jim Fulton.
Steve Purcell [Thu, 8 Aug 2002 13:38:02 +0000 (13:38 +0000)]
Add module-wide "__metaclass__ = type", as requested by Jim Fulton.
(Synched from pyunit CVS)

22 years agoAdded info about highwater heap-memory use for the sortperf.py tests; + a
Tim Peters [Thu, 8 Aug 2002 01:55:16 +0000 (01:55 +0000)]
Added info about highwater heap-memory use for the sortperf.py tests; + a
couple of minor edits elsewhere.

22 years agoPyList_Reverse(): This was leaking a reference to Py_None on every call.
Tim Peters [Thu, 8 Aug 2002 01:06:39 +0000 (01:06 +0000)]
PyList_Reverse():  This was leaking a reference to Py_None on every call.
I believe I introduced this bug when I refactored the reversal code so
that the mergesort could use it too.  It's not a problem on the 2.2 branch.

22 years agoMajor restructuring of _fileobject. Hopefully several things now work
Guido van Rossum [Thu, 8 Aug 2002 01:02:16 +0000 (01:02 +0000)]
Major restructuring of _fileobject.  Hopefully several things now work
correctly (the test at least succeed, but they don't test everything yet).

Also fix a performance problem in read(-1): in unbuffered mode, this would
read 1 byte at a time.  Since we're reading until EOF, that doesn't make
sense.  Use the default buffer size if _rbufsize is <= 1.

22 years agoReplace docstrings on test functions witrh comments -- then unittest
Guido van Rossum [Thu, 8 Aug 2002 01:00:28 +0000 (01:00 +0000)]
Replace docstrings on test functions witrh comments -- then unittest
prints function and module names, which is more informative now that
we repeat some tests in slightly modified subclasses.

Add a test for read() until EOF.

Add test suites for line-buffered (bufsize==1) and a small custom
buffer size (bufsize==2).

Restructure testUnbufferedRead() somewhat to avoid a potentially
infinite loop.

22 years agoAdded info about the right way to leave the body of a trashcan-protected
Tim Peters [Wed, 7 Aug 2002 20:53:05 +0000 (20:53 +0000)]
Added info about the right way to leave the body of a trashcan-protected
destructor early.

22 years agoFix a subtle bug in the trashcan code I added yesterday to
Guido van Rossum [Wed, 7 Aug 2002 20:42:09 +0000 (20:42 +0000)]
Fix a subtle bug in the trashcan code I added yesterday to
subtype_dealloc().

When call_finalizer() failed, it would return without going through
the trashcan end macro, thereby unbalancing the trashcan nesting level
counter, and thereby defeating the test case (slottrash() in
test_descr.py).  This in turn meant that the assert in the GC_UNTRACK
macro wasn't triggered by the slottrash() test despite a bug in the
code: _PyTrash_destroy_chain() calls the dealloc routine with an
object that's untracked, and the assert in the GC_UNTRACK macro would
fail on this; but because of an earlier test that resurrects an
object, causing call_finalizer() to fail and the trashcan nesting
level to be unbalanced, so _PyTrash_destroy_chain() was never called.
Calling the slottrash() test in isolation *did* trigger the assert,
however.

So the fix is twofold: (1) call the GC_UnTrack() function instead of
the GC_UNTRACK macro, because the function is safe when the object is
already untracked; (2) when call_finalizer() fails, jump to a label
that exits through the trashcan end macro, keeping the trashcan
nesting balanced.

22 years agoGvR pointed out that only enclosing function bodies are part of nested scopes.
Raymond Hettinger [Wed, 7 Aug 2002 20:20:52 +0000 (20:20 +0000)]
GvR pointed out that only enclosing function bodies are part of nested scopes.

22 years agoAdd -E and -tt options to the python invocations, as for the Unix tests.
Guido van Rossum [Wed, 7 Aug 2002 19:06:27 +0000 (19:06 +0000)]
Add -E and -tt options to the python invocations, as for the Unix tests.
The -tt means modules that mix tabs and spaces will be rejected.
The -E refuses to believe Python options in the environment.

22 years agoReplace tabs with spaces. (Sorry!)
Guido van Rossum [Wed, 7 Aug 2002 19:03:35 +0000 (19:03 +0000)]
Replace tabs with spaces.  (Sorry!)

22 years agoTighten the unbuffered readline test to distinguish between the two lines.
Guido van Rossum [Wed, 7 Aug 2002 19:02:49 +0000 (19:02 +0000)]
Tighten the unbuffered readline test to distinguish between the two lines.

22 years agoSimplify heapreplace() -- there's no need for an explicit test for
Guido van Rossum [Wed, 7 Aug 2002 18:58:11 +0000 (18:58 +0000)]
Simplify heapreplace() -- there's no need for an explicit test for
empty heap, since heap[0] raises the appropriate IndexError already.

22 years agoDocument that heappop() and heapreplace() raise IndexError if the heap
Guido van Rossum [Wed, 7 Aug 2002 18:56:08 +0000 (18:56 +0000)]
Document that heappop() and heapreplace() raise IndexError if the heap
is empty.

22 years agoApply character{} markup.
Raymond Hettinger [Wed, 7 Aug 2002 16:53:17 +0000 (16:53 +0000)]
Apply character{} markup.

22 years agoReplace abort with Py_FatalError.
Martin v. Löwis [Wed, 7 Aug 2002 16:21:51 +0000 (16:21 +0000)]
Replace abort with Py_FatalError.

22 years agoDescribed responsibilty of weakly referenced extension types to initialize
Raymond Hettinger [Wed, 7 Aug 2002 16:18:54 +0000 (16:18 +0000)]
Described responsibilty of weakly referenced extension types to initialize
the weakreflist to NULL in the constructor and to fill the tp_flags
slot with Py_TPFLAGS_HAVE_WEAKREFS.  Closes SF bug 586583.

22 years agoDescribe nested scopes in the tutorial. Closes SF bug 500704.
Raymond Hettinger [Wed, 7 Aug 2002 16:09:48 +0000 (16:09 +0000)]
Describe nested scopes in the tutorial.  Closes SF bug 500704.

22 years agoOops. I accidentally commented out some tests.
Guido van Rossum [Wed, 7 Aug 2002 16:03:06 +0000 (16:03 +0000)]
Oops.  I accidentally commented out some tests.

22 years agoRegenerated with OSA class inheritance and fix for non-ascii chars.
Jack Jansen [Wed, 7 Aug 2002 15:53:42 +0000 (15:53 +0000)]
Regenerated with OSA class inheritance and fix for non-ascii chars.

22 years agoFixed incorrect logic in determining whether we should initialize
Jack Jansen [Wed, 7 Aug 2002 15:52:44 +0000 (15:52 +0000)]
Fixed incorrect  logic in determining whether we should initialize
the classes' attribute list.

22 years agoDocumented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger [Wed, 7 Aug 2002 15:48:17 +0000 (15:48 +0000)]
Documented os.fsync and os.fdatasync.  Closes SF bug 584695.

22 years ago"Unbuffered" mode of class _fileobject wasn't actually unbuffered,
Guido van Rossum [Wed, 7 Aug 2002 15:46:19 +0000 (15:46 +0000)]
"Unbuffered" mode of class _fileobject wasn't actually unbuffered,
and this broke a Zope "pipelining" test which read multiple responses
from the same connection (this attaches a new file object to the
socket for each response).  Added a test for this too.

(I want to do some code cleanup too, but I thought I'd first fix
the problem with as little code as possible, and add a unit test
for this case.  So that's what this checkin is about.)

22 years ago- If an OSA identifier is a Python reserved word we now append an _
Jack Jansen [Wed, 7 Aug 2002 15:44:53 +0000 (15:44 +0000)]
- If an OSA identifier is a Python reserved word we now append an _
  in stead of prepending it, which messes up "import * from".
- A few ascii()s added again.
- Changed the getbaseclasses a little, but it still isn't perfect.

22 years agoClarify that the bool instances are acceptable return values from
Fred Drake [Wed, 7 Aug 2002 15:40:15 +0000 (15:40 +0000)]
Clarify that the bool instances are acceptable return values from
__nonzero__(), in response to SF bug #579991.

22 years agoUse Py_FatalError instead of abort.
Martin v. Löwis [Wed, 7 Aug 2002 15:18:57 +0000 (15:18 +0000)]
Use Py_FatalError instead of abort.

22 years agoDon't be over-enthusiastic with the ascii() calls: we don't need it if
Jack Jansen [Wed, 7 Aug 2002 15:05:42 +0000 (15:05 +0000)]
Don't be over-enthusiastic with the ascii() calls: we don't need it if
the result passes through backticks.

22 years agoDonovan Preston's patch #538395, with some mods by me.
Jack Jansen [Wed, 7 Aug 2002 14:49:00 +0000 (14:49 +0000)]
Donovan Preston's patch #538395, with some mods by me.

This patch makes inheritance for OSA classes work. The implementation is a
bit convoluted, but I don't immedeately see a simpler way of doing it.

I added calls to ascii() everywhere we output strings that may contain
non-ascii characters (Python has gotten very picky since the encoding
patch:-).

I also removed Donovan's different way of opening resource files: I don't
seem to need it.

22 years agoQuote the arguments, they may contain strings.
Jack Jansen [Wed, 7 Aug 2002 14:05:58 +0000 (14:05 +0000)]
Quote the arguments, they may contain strings.

22 years agoFix up some more markup problems.
Fred Drake [Wed, 7 Aug 2002 13:24:09 +0000 (13:24 +0000)]
Fix up some more markup problems.

22 years agoChange the markup a bit more; the parameter was not marked as \var in the
Fred Drake [Wed, 7 Aug 2002 12:39:33 +0000 (12:39 +0000)]
Change the markup a bit more; the parameter was not marked as \var in the
sample code, and the note was marked as a logical thing.

22 years agoFix PEP 263 code --without-unicode. Fixes #591943.
Martin v. Löwis [Wed, 7 Aug 2002 12:33:18 +0000 (12:33 +0000)]
Fix PEP 263 code --without-unicode. Fixes #591943.