The two clients in the std library have been updated to use the newer
interface. A couple of minor changes to the httplib tests were
needed.
Also, reformat some long lines in the httplib tests.
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.
- 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')
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.
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.
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"
datetime.time(12, 47, tzinfo=FixedOffset()).strftime('%Z')
This code is very tricky and I'm not positive it works. However,
it neither crashes nor leaks.
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