Index: Lib/mimetypes.py =================================================================== --- Lib/mimetypes.py (revision 85786) +++ Lib/mimetypes.py (working copy) @@ -27,6 +27,7 @@ import sys import posixpath import urllib +from itertools import count try: import _winreg except ImportError: @@ -239,19 +240,11 @@ return def enum_types(mimedb): - i = 0 - while True: + for i in count(): try: - ctype = _winreg.EnumKey(mimedb, i) + yield _winreg.EnumKey(mimedb, i) except EnvironmentError: break - try: - ctype = ctype.encode(default_encoding) # omit in 3.x! - except UnicodeEncodeError: - pass - else: - yield ctype - i += 1 default_encoding = sys.getdefaultencoding() with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,