Guido van Rossum [Thu, 16 Aug 2007 23:48:43 +0000 (23:48 +0000)]
First merge from the trunk straight into the py3k branch. I'm not
using the message generated by svnmerge, because it contains a lot of
stuff about the Doc tree, which I'm not merging this time due to the
way the Doc tree was initially added. I am however adding roman.py
which was added later to Doc/tools. I'll try to diff the two Doc
trees separately to see if there's stuff I missed.
Walter Dörwald [Thu, 16 Aug 2007 21:55:45 +0000 (21:55 +0000)]
Apply SF patch #1775604: This adds three new codecs (utf-32, utf-32-le and
ut-32-be). On narrow builds the codecs combine surrogate pairs in the unicode
object into one codepoint on encoding and create surrogate pairs for
codepoints outside the BMP on decoding. Lone surrogates are passed through
unchanged in all cases.
Jeremy Hylton [Thu, 16 Aug 2007 17:55:18 +0000 (17:55 +0000)]
Remove last(?) use of httplib.HTTPS, which caused test_socket_ssl to fail.
Refactor the urllib open_http() and open_https() to use the same
internal logic. The only difference between the two is the call to
constructor an HTTPConnection object.
Jeremy Hylton [Tue, 14 Aug 2007 16:47:39 +0000 (16:47 +0000)]
Change xmlrpclib to use the newer httplib interface.
Note that it's hard to test xmlrpclib, because the server it attempts
to connect to doesn't seem to support the expected interfaces. Many
of the links via xmlrpc.com are dead, so I couldn't find another
server to use for tests.
Guido van Rossum [Mon, 13 Aug 2007 18:43:36 +0000 (18:43 +0000)]
Don't mess with string.letters any more. It is most likely going to disappear.
Even if it isn't, it shouldn't be changed based on the locale setting IMO.
(Incidentally, this makes test_csv.py pass again on my box.)
Guido van Rossum [Mon, 13 Aug 2007 17:50:00 +0000 (17:50 +0000)]
Improved patches for sndhdr and imghdr by Victor Stinner, who writes:
- fix "h[sbseek] == b'\1'" and "ratecode = ord(h[sbseek+4])" in test_voc()
- avoid division by zero
- use startswith method: replace h[:2] == b'BM' by h.startswith(b'BM')
- use aifc.open() instead of old aifc.openfp()
- use ord(b'P') instead of ord('P')
Neal Norwitz [Sun, 12 Aug 2007 17:23:54 +0000 (17:23 +0000)]
Cleanup a little.
Use bit fields for flags to reduce memory usage.
Return booleans where they are documented. Although a boolean for
seekable seems a bit odd when it can be unknown. Add a comment about this.
Barry Warsaw [Sun, 12 Aug 2007 14:37:20 +0000 (14:37 +0000)]
Compare what's read from files against proper byte literals. Neither of these
modules have unittests AFAICT, and I'm not improving things here, but these
changes make a bunch of email package tests succeed, and command line testing
against real files seems to make things better.
Added an __main__ section to imghdr.py so that it can be run from the command
line similarly to sndhdr.py. Someone else can figure out a better -m way of
doing this.
In sndhdr.py do a couple of very minor cleanups, and use a with statement to
not wait for gc to close the file.
Neal Norwitz [Sun, 12 Aug 2007 04:32:26 +0000 (04:32 +0000)]
Fix the refleak in strftime when converting a %Z with a user defined tzinfo.
I inverted some of the conditionals to reduce indent levels. Hopefully
this makes it a little easier to read.
This code caused the leak:
class FixedOffset(datetime.tzinfo):
def tzname(self, dt): return "UTC"
Kurt B. Kaiser [Sun, 12 Aug 2007 01:52:35 +0000 (01:52 +0000)]
1. Catch TypeError exception when writing to OutputWindow
2. PyShell: shell isn't working due to encoding issues. Temporarily direct
exceptions to the terminal. Also, trap exceptions occurring during write()
instead of passing.
Checking (2) in temporarily to aid finding the encoding problem in
IOBinding.py
Neal Norwitz [Sat, 11 Aug 2007 06:39:53 +0000 (06:39 +0000)]
Remove support for __members__ and __methods__. There still might be
some cleanup to do on this. Particularly in Python/traceback.c with
getting rid of the getattr if possible and Demo/*metaclasses/Enum.py.
In PyFile_WriteString(), call PyUnicode_FromString() instead of
PyString_FromString(). This is arguably more correct, even if it
shouldn't matter much (all the input is likely to be ASCII).