Mark Hammond [Mon, 12 Aug 2002 13:06:35 +0000 (13:06 +0000)]
Correct PyAPI_FUNC to PyAPI_DATA - sorry Jack.
Marc-André Lemburg [Mon, 12 Aug 2002 08:19:10 +0000 (08:19 +0000)]
Add name mangling for new PyUnicode_FromOrdinal() and fix declaration
to use new extern macro.
Mark Hammond [Mon, 12 Aug 2002 07:21:58 +0000 (07:21 +0000)]
Excise DL_EXPORT from Include.
Thanks to Skip Montanaro and Kalle Svensson for the patches.
Tim Peters [Mon, 12 Aug 2002 06:17:58 +0000 (06:17 +0000)]
x_mul(): This failed to normalize its result.
k_mul(): This didn't allocate enough result space when one input had
more than twice as many bits as the other. This was partly hidden by
that x_mul() didn't normalize its result.
The Karatsuba recurrence is pretty much hosed if the inputs aren't
roughly the same size. If one has at least twice as many bits as the
other, we get a degenerate case where the "high half" of the smaller
input is 0. Added a special case for that, for speed, but despite that
it helped, this can still be much slower than the "grade school" method.
It seems to take a really wild imbalance to trigger that; e.g., a
2**22-bit input times a 1000-bit input on my box runs about twice as slow
under k_mul than under x_mul. This still needs to be addressed.
I'm also not sure that allocating a->ob_size + b->ob_size digits is
enough, given that this is computing k = (ah+al)*(bh+bl) instead of
k = (ah-al)*(bl-bh); i.e., it's certainly enough for the final result,
but it's vaguely possible that adding in the "artificially" large k may
overflow that temporarily. If so, an assert will trigger in the debug
build, but we'll probably compute the right result anyway(!).
Tim Peters [Mon, 12 Aug 2002 05:09:36 +0000 (05:09 +0000)]
Introduced helper functions v_iadd and v_isub, for in-place digit-vector
addition and subtraction. Reworked the tail end of k_mul() to use them.
This saves oodles of one-shot longobject allocations (this is a triply-
recursive routine, so saving one allocation in the body saves 3**n
allocations at depth n; we actually save 2 allocations in the body).
Guido van Rossum [Mon, 12 Aug 2002 03:42:03 +0000 (03:42 +0000)]
New news about __class__ assignment restrictions and speed-up of
new-style object creation/deallocation.
Moved all news about type/class unification and new-stype classes to a
separate section at the top.
Neal Norwitz [Mon, 12 Aug 2002 03:33:32 +0000 (03:33 +0000)]
Revert what looks like a typo from the last checkin
Tim Peters [Mon, 12 Aug 2002 02:54:10 +0000 (02:54 +0000)]
k_mul(): Repaired another typo in another comment.
Tim Peters [Mon, 12 Aug 2002 02:43:58 +0000 (02:43 +0000)]
k_mul(): Repaired typo in comment.
Tim Peters [Mon, 12 Aug 2002 02:31:19 +0000 (02:31 +0000)]
Cautious introduction of a patch that started from
SF 560379: Karatsuba multiplication.
Lots of things were changed from that. This needs a lot more testing,
for correctness and speed, the latter especially when bit lengths are
unbalanced. For now, the Karatsuba code gets invoked if and only if
envar KARAT exists.
Tim Peters [Sun, 11 Aug 2002 18:28:09 +0000 (18:28 +0000)]
Fixed misspelling in comment.
Tim Peters [Sun, 11 Aug 2002 17:54:42 +0000 (17:54 +0000)]
int_lshift(): Simplified/sped overflow-checking.
Ka-Ping Yee [Sun, 11 Aug 2002 15:11:33 +0000 (15:11 +0000)]
Extend stripid() to handle strings ending in more than one '>'.
Add resolve() to handle looking up objects and names (fix SF bug 586931).
Add a nicer error message when given a filename that doesn't exist.
Guido van Rossum [Sun, 11 Aug 2002 14:06:15 +0000 (14:06 +0000)]
Reset errno to zero after calling PyErr_Warn(). It can potentially do
a lot of work, including I/O (e.g. to import warnings.py), which might
affect errno.
Guido van Rossum [Sun, 11 Aug 2002 14:04:13 +0000 (14:04 +0000)]
Use a better check for overflow from a<<b.
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.
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.
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.
Tim Peters [Sat, 10 Aug 2002 21:32:16 +0000 (21:32 +0000)]
And one more simplification to test_saveall().
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).
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.
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.
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.
Mark Hammond [Sat, 10 Aug 2002 06:26:31 +0000 (06:26 +0000)]
Clarify that the interruptable popen fixes aren't used under Win9x.
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.
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.
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).
Guido van Rossum [Sat, 10 Aug 2002 00:17:59 +0000 (00:17 +0000)]
Fix a typo in the mktemp -> mkstemp patch.
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.
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.
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.
Guido van Rossum [Fri, 9 Aug 2002 19:18:25 +0000 (19:18 +0000)]
Whitespace normalization.
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.
Fred Drake [Fri, 9 Aug 2002 18:35:52 +0000 (18:35 +0000)]
Add weakref support generator-iterators.
Part of fixing SF bug #591704.
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.
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.
Tim Peters [Fri, 9 Aug 2002 18:01:01 +0000 (18:01 +0000)]
Whitespace normalization.
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.
Guido van Rossum [Fri, 9 Aug 2002 17:38:16 +0000 (17:38 +0000)]
Test finalizers and GC from inside __del__ for new classes.
Guido van Rossum [Fri, 9 Aug 2002 17:17:07 +0000 (17:17 +0000)]
Credit to Oren for the file-iterator patch.
Guido van Rossum [Fri, 9 Aug 2002 17:16:30 +0000 (17:16 +0000)]
News about the tempfile rewrite.
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.
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!
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.
Guido van Rossum [Fri, 9 Aug 2002 16:11:37 +0000 (16:11 +0000)]
Test for 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__.
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.
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.
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.
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.
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
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.
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.
Sjoerd Mullender [Fri, 9 Aug 2002 13:37:31 +0000 (13:37 +0000)]
Document that -u puts stdin, stdout, and stderr in binary mode.
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).
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.
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.
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.
Jack Jansen [Fri, 9 Aug 2002 09:03:31 +0000 (09:03 +0000)]
Depracated some non-carbon modules.
Jack Jansen [Fri, 9 Aug 2002 09:02:01 +0000 (09:02 +0000)]
This file should have gone long ago.
Tim Peters [Fri, 9 Aug 2002 05:06:44 +0000 (05:06 +0000)]
Repaired a braino in the description of bad minrun values.
Neal Norwitz [Fri, 9 Aug 2002 03:37:42 +0000 (03:37 +0000)]
SF bug #592645 fix memory leak in socket.getaddrinfo
Fred Drake [Fri, 9 Aug 2002 02:39:13 +0000 (02:39 +0000)]
Update the text on the Expat module and library.
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).
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.
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.
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.
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.
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).
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.
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.)
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.
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.
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.
Tim Peters [Thu, 8 Aug 2002 20:19:19 +0000 (20:19 +0000)]
Whitespace normalization.
Tim Peters [Thu, 8 Aug 2002 20:07:03 +0000 (20:07 +0000)]
Delete junk attributes left behind by _socketobject class construction.
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.
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.
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.
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. :-)
Guido van Rossum [Thu, 8 Aug 2002 15:25:28 +0000 (15:25 +0000)]
Extend __all__ with the exports list of the _ssl module.
Guido van Rossum [Thu, 8 Aug 2002 15:22:12 +0000 (15:22 +0000)]
Oops, stupid tabs. Sorry again.
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).
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)
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.
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.
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.
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.
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.
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.
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.
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.
Guido van Rossum [Wed, 7 Aug 2002 19:03:35 +0000 (19:03 +0000)]
Replace tabs with spaces. (Sorry!)
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.
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.
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.
Raymond Hettinger [Wed, 7 Aug 2002 16:53:17 +0000 (16:53 +0000)]
Apply character{} markup.
Martin v. Löwis [Wed, 7 Aug 2002 16:21:51 +0000 (16:21 +0000)]
Replace abort with Py_FatalError.
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.
Raymond Hettinger [Wed, 7 Aug 2002 16:09:48 +0000 (16:09 +0000)]
Describe nested scopes in the tutorial. Closes SF bug 500704.