Fred Drake [Thu, 12 Sep 2002 18:01:26 +0000 (18:01 +0000)]
Minor revision to the "\\" patch, including updating the docs a little to
accomodate the fact that they are more general now that they are for the
os.path module and not just posixpath.
This and the previous patch should be combined and applied to the 2.2-maint
branch.
Fred Drake [Thu, 12 Sep 2002 17:02:01 +0000 (17:02 +0000)]
Relax a test so it passes either with the standard library or PyXML.
The original expected value is actually wrong, but we'll pick up the
real fix and test when we refresh the xml package from PyXML before
2.3a1.
Only build the 'dl' extension when sys.maxint equals 2**31-1.
This module raises "SystemError: module dl requires sizeof(int) ==
sizeof(long) == sizeof(char*)" when compiled on 64-bit platforms.
Undocumented feature: MHMailbox sets the msg object's _mh_msgno
attribute to the (stringized) message number (if this attribute is
settable). This is useful so users of this class can report the
correct message number (e.g. when classifying spam).
Also added a blank line before the first method of each class.
I don't think it's safe to use map.iteritems() in the various poll
routines. I got some errors "dictionary changed size during
iteration" when running ZEO tests on machine while doing heavy
forground work in another window, and thinking about it, I believe
that it should be okay if readable() or writable() modifies the map.
I also finally made all the spacing conform to the Python style guide:
no space between a function/method name and the following left
parenthesis (fixed lots of occurrences), spaces around assignment
operators (fixed a few, always of the form "map=..."), and a blank
line between the class statement and the first method definition (a
few).
Walter Dörwald [Wed, 11 Sep 2002 20:36:02 +0000 (20:36 +0000)]
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)
This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.
Insert an overflow check when the sequence repetition count is outside
the range of ints. The old code would pass random truncated bits to
sq_repeat() on a 64-bit machine.
The list(xrange(sys.maxint / 4)) test blew up on 64-bit platforms.
Because ob_size is a 32-bit int but sys.maxint is LONG_MAX which is a
64-bit value, there's no way to make this test succeed on a 64-bit
platform. So just skip it when sys.maxint isn't 0x7fffffff.
Untested code for 64-bit platforms. range_length() is declared as int
but returns r->len which is a long. This doesn't even cause a warning
on 32-bit platforms, but can return bogus values on 64-bit platforms
(and should cause a compiler warning). Fix this by inserting a range
check when LONG_MAX != INT_MAX, and adding an explicit cast to (int)
when the test passes. When r->len is out of range, PySequence_Size()
and hence len() will report an error (but an iterator will still
work).
Barry Warsaw [Wed, 11 Sep 2002 02:56:42 +0000 (02:56 +0000)]
test_both(): I believe this was a typo: m is only defined if no
exception occurred so it should only be closed in the else clause.
Without this change we can an UnboundLocalError on Linux:
Traceback (most recent call last):
File "Lib/test/test_mmap.py", line 304, in ?
test_both()
File "Lib/test/test_mmap.py", line 208, in test_both
m.close()
UnboundLocalError: local variable 'm' referenced before assignment
Barry Warsaw [Wed, 11 Sep 2002 02:22:48 +0000 (02:22 +0000)]
rfc822.unquote() doesn't properly de-backslash-ify in Python prior to
2.3. This patch (adapted from Quinn Dunkan's SF patch #573204) fixes
the problem and should get ported to rfc822.py.
Tim Peters [Tue, 10 Sep 2002 21:19:55 +0000 (21:19 +0000)]
I left some debugging junk in here; removed it. Also replaced a few
more instances of the bizarre "del f; del m" ways to spell .close() (del
won't do any good here under Jython, etc).
Tim Peters [Tue, 10 Sep 2002 20:49:15 +0000 (20:49 +0000)]
A few days ago a test was added here to ensure that creating an mmap
with a size larger than the underlying file worked on Windows. It
does <wink>. However, merely creating an mmap that way has the side
effect of growing the file on disk to match the specified size. A
*later* test assumed that the file on disk was still exactly as it was
before the new "size too big" test was added, but that's no longer true.
So added a hack at the end of the "size too big" test to truncate the
disk file back to its original size on Windows.
Barry Warsaw [Tue, 10 Sep 2002 16:14:56 +0000 (16:14 +0000)]
_parsebody(): Instead of raising a BoundaryError when no start
boundary could be found -- in a lax parser -- the entire body is
assigned to the message payload.
Barry Warsaw [Tue, 10 Sep 2002 16:13:45 +0000 (16:13 +0000)]
Import _isstring() from the compatibility layer.
_handle_text(): Use _isstring() for stringiness test.
_handle_multipart(): Add a test before the ListType test, checking for
stringiness of the payload. String payloads for multitypes means a
message with broken MIME chrome was parsed by a lax parser. Instead
of raising a BoundaryError in those cases, the entire body is assigned
to the message payload (but since the content type is still
multipart/*, the Generator needs to be updated too).
shutil.copyfile(src,dst) was clobbering the file when the src and dst were
the same. Added check to verify the two names are not the same. Does not
check the actual files to see if there is a symbolic link.
Jeremy Hylton [Sun, 8 Sep 2002 00:14:54 +0000 (00:14 +0000)]
A little refactoring.
Add read(), write(), and readwrite() helper functions to shorten poll
functions. Use get() instead of try/except KeyError for lookup.
XXX How could the lookup ever fail?
Remove module-level DEBUG flag.
Use iteritems() instead of items() when walking the socket map.
Reformat the functions I touched so that are consistently Pythonic.
Jack Jansen [Fri, 6 Sep 2002 23:03:32 +0000 (23:03 +0000)]
Reorganized order of help menu, and don't show Carbon documentation
entries on OS9 (where they are never available, and simply disabling
them might lead people to think otherwise).
Jack Jansen [Fri, 6 Sep 2002 21:57:50 +0000 (21:57 +0000)]
Skip UDP testing for MacPython (for now), it hangs. This may be due to
GUSI/Threading interaction, I'm not sure, but I don't have the time to fix this right now.
Jack Jansen [Fri, 6 Sep 2002 19:47:49 +0000 (19:47 +0000)]
Script to generate .pkg packages, donated by Dinu Gherman. This is his
original code, it still needs fiddling to make it work in general
circumstances.
Added a tutorial note and example regarding the scope of loop variables
in a list comprehension. Includes a justification and a comparision
to regular for-loops.
Walter Dörwald [Fri, 6 Sep 2002 16:15:58 +0000 (16:15 +0000)]
Apply diff3.txt (plus additional documentation)
from SF patch http://www.python.org/sf/554192
This adds two new functions to mimetypes:
guess_all_extensions() which returns a list of all known
extensions for a mime type, and add_type() which adds one
mapping between a mime type and an extension.
Barry Warsaw [Fri, 6 Sep 2002 03:55:04 +0000 (03:55 +0000)]
_formatparam(), set_param(): RFC 2231 encoding support by Oleg
Broytmann in SF patch #600096. Specifically, the former function now
encodes the triplets, while the latter adds optional charset and
language arguments.
Barry Warsaw [Fri, 6 Sep 2002 03:41:27 +0000 (03:41 +0000)]
test_mondo_message(): "binary" is not a legal content type, so with
the previous RFC 2045, $5.2 repair to get_content_type() this
subpart's type will now be text/plain.