Fred Drake [Wed, 11 Apr 2001 04:38:34 +0000 (04:38 +0000)]
Based on a comment by Konrad Hinsen on python-list:
Change "EOF" to "end-of-file", on the premise that it is easier for
new programmers to understand (at least a little).
This does not attempt to explain "file or device attached to standard
input."
Include py_curses.h *after* defining _XOPEN_SOURCE_EXTENDED.
Michael Hudson suggested this fox for the Tru64 problem (SF bug
232597). It looks reasonable, it works on Tru64, and it doesn't beak
anything on Linux, so I say go for it.
Fred Drake [Tue, 10 Apr 2001 15:53:06 +0000 (15:53 +0000)]
Import the alltt package and wrap that environment in a similar way to
the way we handle verbatim, so that it picks up the same indentation and
minipage behavior.
When doing the quick test to see whether large files are supported,
catch IOError as well as OverflowError. I found that on Tru64 Unix
this was raised; probably because the OS (or libc) doesn't support
large files but the architecture is 64 bits!
When zlib can't be imported, zipfile raises RuntimeError, which causes
the test to be marked as failing rather than skipped. Add an explicit
"import zlib" to prevent this.
Fix synopsis() so it can handle binary module files.
Avoid ever using popen on Windows, since it's broken there.
Factor out the business of getting the summary line into splitdoc().
Use the modulename() routine in inspect.
Show all members of modules and classes rather than filtering on leading '_'.
Small typo and formtating fixes.
Don't show warnings when running "pydoc -k".
Tim Peters [Tue, 10 Apr 2001 05:02:52 +0000 (05:02 +0000)]
test_pickle works on sizeof(long)==8 boxes again.
pickle.py
The code implicitly assumed that all ints fit in 4 bytes, causing all
sorts of mischief (from nonsense results to corrupted pickles).
Repaired that.
marshal.c
The int marshaling code assumed that right shifts of signed longs
sign-extend. Repaired that.
Tim Peters [Tue, 10 Apr 2001 04:35:28 +0000 (04:35 +0000)]
Ack -- this module mixes tabs and spaces, and what appears to be a mix
of 2-space and 4-space indents. Whatever, when I saw the checkin diff it
was clear that what my editor thinks a tab means didn't match this module's
belief. Removed all the tabs from the lines I added and changed, left
everything else alone.
Tim Peters [Tue, 10 Apr 2001 04:22:00 +0000 (04:22 +0000)]
On a sizeof(long)==8 machine, ints in range(2**31, 2**32) were getting
pickled into the signed(!) 4-byte BININT format, so were getting unpickled
again as negative ints. Repaired that.
Added some minimal docs at the top about what I've learned about the pickle
format codes (little of which was obvious from staring at the code,
although that's partly because all the size-related bugs greatly obscured
the true intent of the code).
Happy side effect: because save_int() needed to grow a *proper* range
check in order to fix this bug, it can now use the more-efficient BININT1,
BININT2 and BININT formats when the long's value is small enough to fit
in a signed 4-byte int (before this, on a sizeof(long)==8 box it always
used the general INT format for negative ints).
test_cpickle works again on sizeof(long)==8 machines. test_pickle is
still busted big-time.
Tim Peters [Tue, 10 Apr 2001 03:41:41 +0000 (03:41 +0000)]
Test full range of native ints. This exposes two more binary pickle
bugs on sizeof(long)==8 machines. pickle.py has no idea what it's
doing with very large ints, and variously gets things right by accident,
computes nonsense, or generates corrupt pickles. cPickle fails on
cases 2**31 <= i < 2**32: since it *thinks* those are 4-byte ints
(the "high 4 bytes" are all zeroes), it stores them in the (signed!) BININT
format, so they get unpickled as negative values.
Append the revision number for each file to the output.
(Yes, this is a new feature right before the 2.1 release. No, I can't
imagine this would seriously break anybody's code. In fact, most
users of this script are probably *happy* to see this addition.)
Tim Peters [Tue, 10 Apr 2001 01:54:42 +0000 (01:54 +0000)]
Critical fix: if cPickle on a sizeof(long)==8 box is used to read a
binary pickle, and the latter contains a pickle of a negative Python
int i written on a sizeof(long)==4 box (and whether by cPickle or
pickle.py), it's read incorrectly as i + 2**32. The patch repairs that,
and allows test_cpickle.py (to which I added a relevant test case earlier
today) to work again on sizeof(long)==8 boxes.
There's another (at least one) sizeof(long)==8 binary pickle bug, but in
pickle.py instead. That bug is still there, and test_pickle.py doesn't
catch it yet (try pickling and unpickling, e.g., 1 << 46).
Make on Alpha Tru64 5.1 (as installed on the SF compile farm) doesn't
think that a command starting with '#' is a comment, so move the one
comment in such a position (in the rule for building $(LIBRARY)) to a
harmless position.
Tim Peters [Mon, 9 Apr 2001 20:07:05 +0000 (20:07 +0000)]
Pickles have a number of storage formats for various sizes and kinds of
integers, but the std tests don't exercise most of them. Repair that.
CAUTION: I expect this to fail on boxes with sizeof(long)==8, in the
part of test_cpickle (but not test_pickle) trying to do a binary mode
(not text mode) load of the embedded BINDATA pickle string. Once that
hypothesized failure is confirmed, I'll fix cPickle.c.
Steve Purcell [Mon, 9 Apr 2001 15:37:31 +0000 (15:37 +0000)]
* Remove exc_info() kludge -- it actually messed up the Jython output
* Fixed TestLoader.loadTestsFromName() for nested packages
* Corrected the command-line usage summary
fixing 408085 - redirect from https becomes http
Even though relative redirects are illegal, they are common
urllib treated every relative redirect as though it was to http,
even if the original was https://
As long as we're compensating for server bugs, might as well do
it properly.
Jeremy Hylton [Mon, 9 Apr 2001 13:57:32 +0000 (13:57 +0000)]
Add two arguments to Scope constructor, module scope and class name
Add mangling support
Add get_children() and add_child() methods to Scope
Skip nodes when If test is a false constant
Add test code that checks results against symtable module
Jeremy Hylton [Mon, 9 Apr 2001 04:27:12 +0000 (04:27 +0000)]
Fix "import as" (has always skipping the as name)
Fix com_NEWLINE() so that is accepts arguments, which occurs for lines like:
stmt; # note trailing semicolon
Add XXX about checking for assignment to list comps
Tim Peters [Sun, 8 Apr 2001 23:39:38 +0000 (23:39 +0000)]
Repair portability of sign extension when reading signed ints on boxes
where sizeof(long)==8. This *was* broken on boxes where signed right
shifts didn't sign-extend, but not elsewhere. Unfortunately, apart
from the Cray T3E I don't know of such a box, and Guido has so far
refused to buy me any Cray machines for home Python testing <wink>.
More immediately interesting would be if someone could please test
this on *any* sizeof(long)==8 box, to make sure I didn't break it.
Tim Peters [Sun, 8 Apr 2001 07:23:44 +0000 (07:23 +0000)]
Fix from the Madusa mailing list:
http://groups.yahoo.com/group/medusa/message/333
It's clear that Medusa should not be checking for an empty buffer
via "buf is ''". The patch merely changes "is" to "==". However,
there's a mystery here all the same: Python attempts to store null
strings uniquely, so it's unclear why "buf is ''" ever returned
false when buf actually was empty. *Some* string operations produce
non-unique null strings, e.g.
>>> "abc"*0 is "abc"*0
0
>>>
but they're rare, and I don't see any such operations in asynchat.
Tim Peters [Sat, 7 Apr 2001 20:34:48 +0000 (20:34 +0000)]
SF patch #413552 - Premature decref on object
Jeffery Collins pointed out that filterstring decrefs a character object
before it's done using it. This works by accident today because another
module always happens to have an active reference too at the time. The
accident doesn't work after his Pippy modifications, and since it *is*
an accident even in the mainline Python, it should work by design there too.
The patch accomplishes that.
Fred Drake [Sat, 7 Apr 2001 05:41:39 +0000 (05:41 +0000)]
Start of documentation for the unittest module. Some of this comes from
Steve Purcell's documentation, and a lot of it is written based on
using PyUnit and reading the implementation.
There is more to come, but I want to get this check in before I have a
disk crash or anything else bad happens.
Fred Drake [Thu, 5 Apr 2001 18:26:31 +0000 (18:26 +0000)]
Effectively revert the previous change: leave the new #include in, but
comment it out with an explanation. This makes it easier for someone
who wants the additional symbols to try re-enabling it for their platform.
Fred Drake [Thu, 5 Apr 2001 18:14:50 +0000 (18:14 +0000)]
Added more link attributes based on additonal information from Chris
McCafferty <christopher.mccafferty@csg.ch>, and a bit of experimentation
with Navigator 4.7.
Bug #412086, reported by Peter Wilson: The _curses module doesn't
define COLORS or COLOR_PAIRS until after start_color() is called,
but they were never added to the curses module. Fixed by adding
a wrapper around start_color(), similar to the wrapper around initscr().
Tim Peters [Wed, 4 Apr 2001 18:56:49 +0000 (18:56 +0000)]
Sf bug [ #412214 ] ZipFile constructor leaves files open.
This applies the patch Fred Drake created to fix it.
I'm checking it in since I had to apply the patch anyway in order
to test its behavior on Windows.
Jack Jansen [Tue, 3 Apr 2001 21:56:12 +0000 (21:56 +0000)]
Disable fused-add-mul instructions. They give a nonstandard result for some things that test_coercion complains about. The added performance is probably minimal for Python anyway.
Fred Drake [Tue, 3 Apr 2001 17:41:56 +0000 (17:41 +0000)]
Make reference to the Library Reference in the "What Now?" chapter a
hyperlink.
Fix two English usage errors caught by Jan Wells: Changed "subsequence"
to "sub-sequence" in two places, and avoid improper use of "hopefully" in
the first paragraph of the "What Now?" chapter.
Jack Jansen [Tue, 3 Apr 2001 14:36:35 +0000 (14:36 +0000)]
If the frontmost window is not a Tk window exit the event handling code early. This fixes that using Tk once used to disable cmd-. processing. It may also influence Tk/IDE interaction, I'm not sure.
Tim Peters [Mon, 2 Apr 2001 20:15:57 +0000 (20:15 +0000)]
SF bug [#410708] Condition.wait() and KeyboardInterrupt.
http://sourceforge.net/tracker/?func=detail&aid=410708&group_id=5470&atid=105470
Added try/finally around Condition.wait() guts, so that the lock state gets
restored at the end no matter what happens.