Fix for SF bug #642358: only provide a new with a __dict__ or
__weaklist__ descriptor if we added __dict__ or __weaklist__,
respectively. With unit test.
Add a test for a feature added in rev. 2.82 of typeobject.c:
- SLOT1BINFULL() macro: changed this to check for __rop__ overriding
__op__, like binary_op1() in abstract.c -- the latter only calls the
slot function once if both types use the same slot function, so the
slot function must make both calls -- which it already did for the
__op__, __rop__ order, but not yet for the __rop__, __op__ order
when B.__class__ is a subclass of A.__class__.
Also test the refinement added in rev. 2.201 that fixes the problem
reported in SF bug #623669.
Also test a similar provision in abstract.c's binary_op1().
Add a refinement to SLOT1BINFULL() that fixes the problem reported in
SF bug #623669: only try (e.g.) __rdiv__ before __div__ if the right
class actually overrides it.
GvR's idea to use memset() for the most common special case of repeating
a single character. Shaves another 10% off the running time by avoiding
the lg2(N) loops and cache effects for the other cases.
Fred Drake [Mon, 6 Jan 2003 15:50:32 +0000 (15:50 +0000)]
Fix some nits Guido brought up last August:
- give subsection pages nicer names
- shorten some really long table cells; table cells can't wrap in the
typeset version of the documentation
Jason Tishler [Mon, 6 Jan 2003 12:41:26 +0000 (12:41 +0000)]
Patch #661760: Cygwin auto-import module patch
The attached patch enables shared extension
modules to build cleanly under Cygwin without
moving the static initialization of certain function
pointers (i.e., ones exported from the Python
DLL core) to a module initialization function.
Additionally, this patch fixes the modules that
have been changed in the past to accommodate
Cygwin.
Christian Tismer pointed out the high cost of the loop overhead and
function call overhead for 'c' * n where n is large. Accordingly,
the new code only makes lg2(n) loops.
Interestingly, 'c' * 1000 * 1000 ran a bit faster with old code. At some
point, the loop and function call overhead became cheaper than invalidating
the cache with lengthy memcpys. But for more typical sizes of n, the new
code runs much faster and for larger values of n it runs only a bit slower.
Correct long standing bugs in the methods for random distributions.
The range of u=random() is [0,1), so log(u) and 1/x can fail.
Fix by setting u=1-random() or by reselecting for a usable value.
Tim Peters [Sat, 4 Jan 2003 06:03:15 +0000 (06:03 +0000)]
A new implementation of astimezone() that does what we agreed on in all
cases, plus even tougher tests of that. This implementation follows
the correctness proof very closely, and should also be quicker (yes,
I wrote the proof before the code, and the code proves the proof <wink>).
Remove the random=None nonsense from sample() before it gets set in stone.
It was once available so that faster generators could be substituted. Now,
that is less necessary and preferrably done via subclassing.
Also, clarified and shortened the comments for sample().
Skip Montanaro [Sat, 4 Jan 2003 04:05:51 +0000 (04:05 +0000)]
Merged Misc/AtheOS-NOTES into the platform-specific section. Rewrote the
bsddb module build note to reflect the inclusion of bsddb3 and the demotion
of the old bsddb module.
Kurt B. Kaiser [Sat, 4 Jan 2003 01:43:53 +0000 (01:43 +0000)]
M AutoExpand.py
M Bindings.py
M EditorWindow.py
M PyShell.py
M config-keys.def
M configHandler.py
M help.txt
1. Annotate the shell window with last restart boundary upon restart.
2. Provide a shell menu entry and hot key (F6) to jump to the last
restart boundary.
3. Add a new shell menu feature to restart the shell.
4. Update the help menu to add these features.
5. Update the help menu to put text in same order as the menus.
6. Correct a capitalization inconsistency on the Edit menu: Expand Word
7. Rename the "Debug" menu to be "Shell": it's doing more now.
8. Rearrange the "Shell" menu to make the StackViewer entries adjacent.
9. Add a get_geometry method to EditorWindow, which may be of use in
making window positions persisent.
10. Make <ctrl-v> the "Classic Windows" paste key.
11. Restore decorum on the Help menu by removing "Advice". As Guido said,
things will never be the same. Thanks, David!
SF Patch #661440: Refactor and streamline PyCFunction_Call
Refactor code in PyCFunction_Call giving a modest (tiny) speed boost,
a slight improvement in semantics (now detects invalid flag combinations),
and (arguably) improved clarity (making it blindingly clear which flag
combinations are allowed). All this comes at a cost of a few lines of
code duplication.
* Folded test for METH_KEYWORDS into the switch/case.
* Deferred testing for an empty dictionary until when and where needed.
* Make a similar deferral for filling the "size" variable.
* Inverted the dictionary test so that the common case falls though
instead of making a jump.
Tim Peters [Sat, 4 Jan 2003 00:26:59 +0000 (00:26 +0000)]
Completed astimezone()'s correctness proof. This also proves we can get
the desired compromise behavior during the "problem hour" when DST ends
cheaply (but I haven't yet implemented that).
Walter Dörwald [Fri, 3 Jan 2003 19:33:17 +0000 (19:33 +0000)]
Fix read_mime_types() so that it returns a dict as documented.
This fixes a bug reported as http://www.python.org/sf/661630,
which was introduced in the patch http://www.python.org/sf/554192.
Just van Rossum [Fri, 3 Jan 2003 11:18:56 +0000 (11:18 +0000)]
Fix for bug #661136
Lesson learned: kids should not be allowed to use API's starting
with an underscore :-/
zipimport in 2.3a1 is even more broken than I thought: I attemped
to _PyString_Resize a string created by PyString_FromStringAndSize,
which fails for strings with length 0 or 1 since the latter returns
an interned string in those cases. This would cause a SystemError
with empty source files (and no matching pyc) in the zip archive.
I rewrote the offending code to simply allocate a new buffer and
avoid _PyString_Resize altogether.
Added a test that would've caught the problem.
Barry Warsaw [Thu, 2 Jan 2003 22:48:36 +0000 (22:48 +0000)]
Jack complained that on test_crlf_separation() was failing on MacOS9
because the test file, msg_26.txt which has \r\n line endings, was
getting munged by cvs, which knows to do line ending conversions for
text files. But we want \r\n to be preserved on all platforms, so we
cvs admin'd the file to be -kb (binary), which means we have to open
the file in binary mode to preserve these line ends. Hopefully this
will be the end of the thrashing on this issue (but probably not).
Test passes on *nix now, and Tim confirms it passes on Windows. We'll
leave it to Jack to test MacOS.
Tim Peters [Thu, 2 Jan 2003 21:28:08 +0000 (21:28 +0000)]
The tzinfo methods utcoffset() and dst() must return a timedelta object
(or None) now. In 2.3a1 they could also return an int or long, but that
was an unhelpfully redundant leftover from an earlier version wherein
they couldn't return a timedelta. TOOWTDI.
Kurt B. Kaiser [Thu, 2 Jan 2003 20:33:26 +0000 (20:33 +0000)]
1. Remove obsolete, incorrect comment on non-package installation
2. Add more .txt files to installation
3. Fix the reference to Visual Python, s/b VPython