figure out what the code was doing. The fixes were a combination of
closing open files before deletion, opening files in binary mode, and
plain skipping things that can't work on Windows (BaseTest.decompress
uses a process gimmick that doesn't exist on Windows, and, even if it
did, assumes a "bunzip2" executable is on PATH).
Fixed by catching all exceptions that are subclasses of DistutilsError,
so only the error message will be printed. You can still get the
whole traceback by enabling the Distutils debugging mode.
instead of into a list for a bit of speed/space savings. Reopened the
bug report too (628246), as I'm unclear on why we don't sort out the
cause of the TypeError instead.
The _update method detected mutable elements by trapping TypeErrors.
Unfortunately, this masked useful TypeErrors raised by the iterable
itself. For cases where it is possible for an iterable to raise
a TypeError, the iterable is pre-converted to a list outside the
try/except so that any TypeErrors propagate through.
always available on Windows NT. When the function cannot be loaded,
get_special_folder_path raises OSError, "function not available".
Compiled the exe, and rebuilt bdist_wininst.py.
* Lib/distutils/command/bdist_rpm.py
(bdist_rpm.initialize_options): Included verify_script attribute.
(bdist_rpm.finalize_package_data): Ensure that verify_script is a filename.
(bdist_rpm._make_spec_file): Included verify_script in script_options
tuple.
* Misc/NEWS
Mention change.
from Greg Chapman.
* Modules/_sre.c
(lastmark_restore): New function, implementing algorithm to restore
a state to a given lastmark. In addition to the similar algorithm used
in a few places of SRE_MATCH, restore lastindex when restoring lastmark.
(SRE_MATCH): Replace lastmark inline restoring by lastmark_restore(),
function. Also include it where missing. In SRE_OP_MARK, set lastindex
only if i > lastmark.
* Lib/test/re_tests.py
* Lib/test/test_sre.py
Included regression tests for the fixed bugs.
* Misc/NEWS
Mention fixes.
where in lax parsing, the first non-header line after a header block
(e.g. the first line not containing a colon, and not a continuation),
can be treated as the first body line, even without the RFC mandated
blank line separator.
rfc822 had this behavior, and I vaguely remember problems with this,
but can't remember details. In any event, all the tests still pass,
so I guess we'll find out. ;/
This patch works by returning the non-header, non-continuation line
from _parseheader() and using that as the first header line prepended
to fp.read() if given. It's usually None.
We use this approach instead of trying to seek/tell the file-like
object.
multipart/digest isn't a message/rfc822. This is legal, but counter
to recommended practice in RFC 2046, $5.1.5.
The fix is to look at the content type after setting the default
content type. If the maintype is then message or multipart, attach
the parsed subobject, otherwise use set_payload() to set the data of
the other object.
The last round boosted "the limit" from 2GB to 4GB. This round gets
rid of the 4GB limit. For files > 4GB, gzip stores just the last 32
bits of the file size, and now we play along with that too. Tested
by hand (on a 6+GB file) on Win2K.
Boosting from 2GB to 4GB was arguably enough "a bugfix". Going beyond
that smells more like "new feature" to me.
blocked in select(), this will raise select.error with errno set to
EINTR. The except clauses correctly ignores this error, but the rest
of the logic will then call read() for all objects in select's *input*
list of read file descriptors. Then when an object's read_handler()
is naive, it will call recv() on its socket, which will raise an
IOError, and then asyncore decides to close the socket. To fix this,
we simply return in this case.
Backport candidate.
[#413582] g++ must be called for c++ extensions
[#454030] distutils cannot link C++ code with GCC
topdir = "Lib/distutils"
* bcppcompiler.py
(BCPPCompiler.create_static_lib): Fixed prototype, removing extra_preargs
and extra_postargs parameters. Included target_lang parameter.
(BCPPCompiler.link): Included target_lang parameter.
* msvccompiler.py
(MSVCCompiler.create_static_lib): Fixed prototype, removing extra_preargs
and extra_postargs parameters. Included target_lang parameter.
(MSVCCompiler.link): Included target_lang parameter.
* ccompiler.py
(CCompiler): New language_map and language_order attributes, used by
CCompiler.detect_language().
(CCompiler.detect_language): New method, will return the language of
a given source, or list of sources. Individual source language is
detected using the language_map dict. When mixed sources are used,
language_order will stablish the language precedence.
(CCompiler.create_static_lib, CCompiler.link, CCompiler.link_executable,
CCompiler.link_shared_object, CCompiler.link_shared_lib):
Inlcuded target_lang parameter.
* cygwinccompiler.py
(CygwinCCompiler.link): Included target_lang parameter.
* emxccompiler.py
(EMXCCompiler.link): Included target_lang parameter.
* mwerkscompiler.py
(MWerksCompiler.link): Included target_lang parameter.
* extension.py
(Extension.__init__): New 'language' parameter/attribute, initialized
to None by default. If provided will overlap the automatic detection
made by CCompiler.detect_language(), in build_ext command.
* sysconfig.py
(customize_compiler): Check Makefile for CXX option, and also the
environment variable CXX. Use the resulting value in the 'compiler_cxx'
parameter of compiler.set_executables().
* unixccompiler.py
(UnixCCompiler): Included 'compiler_cxx' in executables dict, defaulting
to 'cc'.
(UnixCCompiler.create_static_lib): Included target_lang parameter.
(UnixCCompiler.link): Included target_lang parameter, and made
linker command use compiler_cxx, if target_lang is 'c++'.
* command/build_ext.py
(build_ext.build_extension): Pass new ext.language attribute
to compiler.link_shared_object()'s target_lang parameter. If
ext.language is not provided, detect language using
compiler.detect_language(sources) instead.
* command/config.py
(config._link): Pass already available lang parameter as target_lang
parameter of compiler.link_executable().
/* this is harder to get right than you might think */
angered some God somewhere. After noticing
>>> range(5000000)[slice(96360, None, 439)]
[]
I found that my cute test for the slice being empty failed due to
overflow. Fixed, and added simple test (not the above!).
_locale.getdefaultlocale. Guessing a leading underscore was intended,
but don't really understood this stuff (locale looks like Spanish for
the opposite of global to me <wink>).
customize_compiler() now looks at various environment variables and uses
their values to override the configured C compiler/preprocessor/linker
binary and flags.
Fixed the signed/unsigned confusions when dealing with files >= 2GB.
4GB is still a hard limitation of the gzip file format, though.
Testing this was a bitch on Win98SE due to frequent system freezes. It
didn't freeze while running gzip, it kept freezing while trying to *create*
a > 2GB test file! This wasn't Python's doing. I don't know of a
reasonable way to test this functionality in regrtest.py, so I'm not
checking in a test case (a test case would necessarily require creating
a 2GB+ file first, using gzip to zip it, using gzip to unzip it again,
and then compare before-and-after; so >4GB free space would be required,
and a loooong time; I did all this "by hand" once).
Bugfix candidate, I guess.
whether the Distutils being used supports a particularly capability.
(This idea was originally suggested by Juergen Hermann as a method
on the Distribution class. I think it makes more sense as a
function in core.py, and that's what this patch implements.)
bug #596434. (Alas, I don't think this completely covers that bug.)
Remove 'wrapper' argument from BaseTestCase.check_split() -- it's not
actually needed.
arguments, triggering a warning instead of raising an exception. (In
1.5.2/2.0, it will print to stderr.)
Bugfix candidate for all previous versions. This changes behaviour,
but the old behaviour wasn't very useful. If Distutils version X+1
adds a new keyword argument, using the new keyword means your setup.py
file won't work with Distutils version X any more.
Since properties are supported here, is possible that
instance_getattr2() raises an exception. Fix all code that made this
assumption.
Backport candidate.
indirectly via %(__name__)s. Not sure why, but maintain the
documented behavior for the new items() method.
Be a little more efficient about how we compute the list of options in
the ConfigParser.items() method.
M Debugger.py
M EditorWindow.py
M PyShell.py
0. Polish PyShell.linecache_checkcache()
1. Move break clearing code to PyShell.PyShellEditorWindow from
EditorWindow.
2. Add PyShellEditorWindow.breakpoints attribute to __init__, a list of
line numbers which are breakpoints for that edit window.
3. Remove the code in Debugger which removes all module breakpoints when
debugger is closed. Want to be able to reload into debugger when
restarted.
4. Moved the code which sets EditorWindow.text breakpoints from Debugger
to PyShell.PyShellEditorWindow and refactored.
5. Implement reloading subprocess debugger with breakpoints from all open
PyShellEditorWindows when debugger is opened or subprocess restarted.
6. Eliminate the break_set attribute, use the breakpoint list instead.
Replaces the _center function in the calendar
module with the center method for strings.
For situations with uneven padding, the behavior is
slightly different in that the center method puts the
extra space on the right instead of the left.
classes was called with three arguments. This makes no sense, there's
no way to pass in the "modulo" 3rd argument as for __pow__, and
classic classes don't do this. [SF bug 620179]
I don't want to backport this to 2.2.2, because it could break
existing code that has developed a work-around. Code in 2.2.2 that
wants to use __ipow__ and wants to be forward compatible with 2.3
should be written like this:
def __ipow__(self, exponent, modulo=None):
...
Ben. If s is a byte string, make sure it can be converted to unicode
with the input codec, and from unicode with the output codec, or raise
a UnicodeError exception early. Skip this test (and the unicode->byte
string conversion) when the charset is our faux 8bit raw charset.
must be a Charset instance, not a string. The bug here was that
self._charset wasn't being converted to a Charset instance so later
.append() calls which used the default charset would break.
_split(): If the charset of the chunk is '8bit', return the chunk
unchanged. We can't safely split it, so this is the avenue of least
harm.
8-bit data, we cannot split it safely, so return the original string
unchanged.
_is8bitstring(): Helper function which returns True when we have a
byte string that contains non-ascii characters (i.e. mysterious 8-bit
data).
Also, it fixes a really egregious error in Header.encode() (really
in Header._encode_chunks()) that could cause a header to grow and
grow each time encode() was called if output_codec was different
from input_codec.
Also, fix a typo.
refactor a bit and clean up.
M PyShell.py Cosmetic changes, delete blank lines, add # on some
blank lines.
M rpc.py Add more debugging capability
M run.py Add support for getting calltip from subprocess
Move import statements
initializing GNU readline, setlocale(LC_CTYPE, "") is called, which
changes the <ctype.h> macros to use the "default" locale (which isn't
the *initial* locale -- the initial locale is the "C" locale in which
only ASCII characters are printable). When the default locale is e.g.
Latin-1, the repr() of string objects can include 8-bit characters
with the high bit set; I believe this is due to the recent
PRINT_MULTIBYTE_STRING changes to stringobject.c. This in turn screws
up test_pyexpat and test_rotor, which depend on the repr() of 8-bit
strings with high bit characters.
The solution (for now) is to force the LC_CTYPE locale to "C" after
importing rlcompleter. This is the locale required by the test suite
anyway.
imported on systems other than Windows, and in particular is imported
by test___all__; the compile farm reported that all Linux tests failed
due to this; isn't anyone in PythonDevLand running CVS on Linux?!).
ths "should be" skipped depends on os.path.supports_unicode_filenames,
not really on the platform. Fiddled the expected-skip constructor
appropriately.
list(xrange(sys.maxint / 4))
test. Changed 4 to 2.
The belief is that this test intended to trigger a bit of code in
listobject.c's NRESIZE macro that's looking for arithmetic overflow. As
written, it doesn't achieve that, though, and leaves it up to the platform
realloc() as to whether it wants to allocate 2 gigabytes. Some platforms
say "sure!", although they don't appear to mean it, and disaster ensues.
Changing 4 to 2 (just barely) manages to trigger the arithmetic overflow
test instead, leaving the platform realloc() out of it.
I'll backport this to the 2.2 branch next.
sys.getwindowsversion() on Windows (new enahanced Tim-proof <wink>
version), and fix test_pep277.py in a few minor ways.
Including doc and NEWS entries.
the change in revision 1.11 (test_email.py) in response to SF bug
#609988. We now think that was the wrong fix and that WinZip was the
real culprit there.
get_type(). Also, one of the regular expressions is constant so might
as well make it a module global. And, when splitting up digests,
handle lineseps that are longer than 1 character in length
(e.g. \r\n).
[ 617097 ] EditorWindow.py: underline recent files
Added a couple of mods to reduce the indentation level.
Note that the recent files menu doesn't update until
Idle is restarted, pre-existing bug, at least on Linux.
patch #617312, both on the trunk and the 22-maint branch.
Also added a test case, and ported the test_trace I wrote for HEAD
to 2.2.2 (with all those horrible extra 'line' events ;-).
Strangely, two out of three patches there seem already committed; but
the essential one (get rid of the assert in object_filenames in
ccompiler.py) was not yet applied.
This makes the build procedure for Twisted work again.
This is *not* a backport candidate despite the fact that identical
code appears to exist in 2.2.2; Twisted builds fine there, so there
must have been a change elsewhere.
semantics of header chunks using byte and Unicode strings.
Specifically,
append(): When the given string is a byte string, charset (whether
specified explicitly in the argument list or implicitly via the
constructor default) is the encoding of the byte string, and a
UnicodeError will be raised if the string cannot be decoded with that
charset. If s is a Unicode string, then charset is a hint specifying
the character set of the characters in the string. In this case, when
producing an RFC 2822 compliant header using RFC 2047 rules, the
Unicode string will be encoded using the following charsets in order:
us-ascii, the charset hint, utf-8.
__init__(): Use the global USASCII Charset instance when the charset
argument is None. Also, clarification in the docstring.
Also, use True/False where appropriate.
Python 2.1.3. However it's required by the email tests suite, so poke
it into the encodings aliases if it's missing. The is apparently the
approved API for doing so.
Now we can remove the hexversion shortcircuits in the test suite.
encoding flag SHORTEST means to return the shortest encoding between
base64 and qp. This is used for the header_enc for utf-8. SHORTEST
isn't legal for body_enc.
Also some code cleanup:
- use True/False everywhere
- use == instead of `is' in a few places
- added _unicode() and make consistent the "is unicode" checks
- update docstrings
Closes SF bug #561822.
Integrate the "code cleanup and general bug fix patch" (SF bug #545096),
contributed by Gustavo Niemeyer. This is the portion of that patch that
does not add new functionality.
"Merge Py Idle changes:
Rev 1.7 [Python-idle] loewis
Convert characters from the locale's encoding on output.
Reject characters outside the locale's encoding on input."
Not compatible with Python 2.2.1. Forwardport as a SF patch.
(cut vs. Cut etc.)
Fix Bug 613006 Ctrl-x Unix Binding Clears Selection
(do-nothing does something :)
Leave some debugging prints behind, commented out
M EditorWindow.py
M config-keys.def
M configHandler.py
project, and with assistance from Oleg Broytmann. Specifically,
added some new tests to make sure we handle RFC 2231 encoded
parameters correctly. Two new data files were added which contain RFC
2231 encoded parameters.
project, and with assistance from Oleg Broytmann. Specifically,
get_param(), get_params(): Document that these methods may return
parameter values that are either strings, or 3-tuples in the case of
RFC 2231 encoded parameters. The application should be prepared to
deal with such return values.
get_boundary(): Be prepared to deal with RFC 2231 encoded boundary
parameters. It makes little sense to have boundaries that are
anything but ascii, so if we get back a 3-tuple from get_param() we
will decode it into ascii and let any failures percolate up.
get_content_charset(): New method which treats the charset parameter
just like the boundary parameter in get_boundary(). Note that
"get_charset()" was already taken to return the default Charset
object.
get_charsets(): Rewrite to use get_content_charset().
Move the imports of Parser and Message inside the
message_from_string() and message_from_file() functions. This way
just "import email" won't suck in most of the submodules of the
package.
Note: this will break code that relied on "import email" giving you a
bunch of the submodules, but that was never documented and should not
have been relied on.
A possibility to deadlock (on the hidden import lock) was created here
in 2.3, seemingly when tempfile.py started to call functions in
random.py. The cure is "the usual": don't spawn threads as a side
effect of importing, when the spawned threads themselves do imports
(directly or indirectly), and the code that spawned the threads is
waiting for the threads to finish (they can't finish, because they're
waiting for the import lock the spawner still holds). Worming around
this is why the "test_main" mechanism was introduced in regrest, so
it's a straightforward fix.
NOT a bugfix candidate; the problem was introduced in 2.3.
module used in the Zope TAL implementation. The bug was already fixed
in the Python standard library, but the regression test would be good
to keep around.
This adds new methods heading(), setheading(), position(),
window_width(), window_height(), setx(), and sety(), to make this more
functionality-compatible with Logo turtle graphics (Attila's last
words, not mine :-). I had to fix the sety() code which was broken in
Attila's patch.
I'm not adopting the functionality change that Attila claimed was a
bugfix (no output without tracing), because I disagree that it's a
bug.
This fixes the charming, but unhelpful error message for
>>> pickle.dumps(type.__new__)
Can't pickle <built-in method __new__ of type object at 0x812a440>: it's not the same object as datetime.math.__new__
Bugfix candidate.
Rev 1.6 GvR
Finally fix SF bug #441172, using a variant of patch ##443626:
canceling an edit operation would not revert the value of the field.
The fix takes care to destroy the Entry object, as suggested in the
patch.
Rev 1.7 Geiger Ho / GvR
(previously applied - Idlefork Rev 1.3)
Rev 1.8 doerwalter
(string methods)
Rev 1.11 GvR
Fix for SF bug #448835.
Fix this to work with the new (still undocumented) tabnanny API.
I'm afraid Stephen will have to add this fix to the IDLE fork code
base as well.
Rev 1.12 rhettinger
(skip, done differently in Idlefork)
Rev 1.13 time_one
(skip, NA)
Rev 1.35 fdrake
Use string.ascii_letters instead of string.letters (SF bug #226706).
Move computation of sets of characters out of the body of the function
that uses them.
Rev 1.36 tim_one
Convert a pile of obvious "yes/no" functions to return bool
Rev 1.37
(skip, done differently in Idlefork)
Rev 1.38 loewis
Patch #590913: PEP 263 support.
Rev 1.39 loewis
Convert characters from the locale's encoding on output.
Reject characters outside the locale's encoding on input.
Rev 1.40 doerwalter
(string methods)
Rev 1.41
(skipped, done by GvR in rpc)
Rev 1.5 tim_one
Convert a pile of obvious "yes/no" functions to return bool.
Rev 1.6 gvanrossum
(partially merged previously, move line outside try: block)
Provisional fix for writefile() [SF bug # 541730].
The problem was that an exception can occur in the text.get() call or
in the write() call, when the text buffer contains non-ASCII
characters. This causes the previous contents of the file to be lost.
The provisional fix is to call str(self.text.get(...)) *before*
opening the file, so that if the exception occurs, we never open the
file.
Two orthogonal better solutions have to wait for policy decisions:
1. We could try to encode the data as Latin-1 or as UTF-8; but that
would require IDLE to grow a notion of file encoding which requires
more thought.
2. We could make backups before overwriting a file. This requires
more thought because it needs to be fast and cross-platform and
configurable.
Rev 1.7 gvanrossum
(previously merged with modifications by Stephen M. Gava)
Add primitive printing support for Unix and Windows.
Rev 1.8 loewis
Patch #590913: PEP 263 support.
Rev 1.9 gvanrossum
(tempfile.py interface -- deferred)
Rev 1.10 tim_one
whitespace normalization
Rev 1.11 nnorwitz
(deferred pending 1.9 integration)
Rev 1.39 GvR
Properly fix SF bug #507298 (Gregor Lingl): shellpython2.2 -Qnew smart
indent error
Use // where int division is intended. (This breaks IDLE for use with
previous Python versions -- I don't care.)
Rev 1.40 tim_one
Convert a pile of obvious "yes/no" functions to return bool.
Rev 1.41 foffani/loewis
(already merged) - MS html help
Rev 1.42
(skip, done differently in Idlefork)
Rev 1.43 tzot/rhettinger
Extended IDLE's open module menu item to handle hierarchical module names.
Will look at doing something similar in import.c so that the effort won't
have to be repeated elsewhere.
Closes SF patch 600152.
Rev 1.44 doerwalter
(string methods)
Rev 1.16
(skip. The Edward K. Ream breakpoint fix has been added to bdb.py
and idlefork Debugger.py no longer overrides Bdb.set_break() )
Rev 1.17
Remove unnecessary imports
Rev 1.9
Improve handling of docstrings. I had feared this was a case of
introspection incompatibility, but in fact it's just that calltips
always gave up on a docstring that started with a newline (but
didn't realize they were giving up <wink>).
Rev 1.10
(already merged)
Rev 1.11
(whitespace normalization, skip this time)
Rev 1.12
Remove unnecessary imports
Rev 1.4
SF bug 546078: IDLE calltips cause application error.
Assorted crashes on Windows and Linux when trying to display a very
long calltip, most likely a Tk bug. Wormed around by clamping the
calltip display to a maximum of 79 characters (why 79? why not ...).
Bugfix candidate, for all Python releases.
Rev 1.5
Remove unnecessary imports
EditorWindow has incorporated AutoIndent
Rev 1.17
classifyws(): Fix a "/" to work under -Qnew (as well as without it).
Bugfix candidate!
Rev 1.18
(Already merged)
Rev 1.19
smart_backspace_event(): remove now-pointless int() call.
Bugfix candidate: the current state of AutoIdent.py should be in 2.2.1.
Rev 1.20
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.
Using the suggestion there: add_module() forces __builtin__ back; this
fixes r_exec, r_eval, r_execfile. The interactive console had to be
fixed separately, because it doesn't use r_exec, but relies on the
'locals' dict having the right __builtins__. Fixed this by
subclassing InteractiveConsole and overriding runcode(), which does
the exec. This changes the banner output slightly: instead of
starting with *** RESTRICTED ***, a subtler (RestrictedConsole) is
printed before the first >>> prompt.
Also import readline (if it exists) when the interactive console is
used, for more convenient input editing and history.
This does not mean that rexec is now considered safe! But for those
willing to take the risk, it's safer than before. (Note that a safety
analysis of the code module would be wise if you plan to use the
interactive console for real -- I've only ever used it to play with
restricted mode.)
This should be backported to 2.2 and 2.1.
PyShell.py
don't track Py Idle patch 543222 - disable script bindings in shell
since it was done differently in MAIN
Remove "binding comments" 05 Aug 1.13.2.2 to 1.13.2.3
EditorWindow.py
don't track Py Idle patch 543222 - disable script bindings in shell
since it was done differently in MAIN
Remove "binding comments" 05 Aug 1.23.2.3 to 1.23.2.4
Remove last dependencies to old config backend 06Aug to 1.23.2.5
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.
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).
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.
Backport candidate.
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
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.
_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).
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.
Closes SF bug 490165 and Tzot's patch 604600.
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.
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.
Broytmann in SF patch #600096. Specifically, the former function now
encodes the triplets, while the latter adds optional charset and
language arguments.