Index: Tools/unicode/gencodec.py =================================================================== --- Tools/unicode/gencodec.py (revision 86837) +++ Tools/unicode/gencodec.py (working copy) @@ -52,7 +52,7 @@ """ if not codes: - return None + return -1 l = codes.split('+') if len(l) == 1: return int(l[0],16) @@ -60,8 +60,8 @@ try: l[i] = int(l[i],16) except ValueError: - l[i] = None - l = [x for x in l if x is not None] + l[i] = -1 + l = [x for x in l if x != -1] if len(l) == 1: return l[0] else: @@ -113,7 +113,7 @@ # mappings to None for the rest if len(identity) >= len(unmapped): for enc in unmapped: - enc2uni[enc] = (None, "") + enc2uni[enc] = (-1, "") enc2uni['IDENTITY'] = 256 return enc2uni @@ -211,7 +211,7 @@ (mapkey, mapcomment) = mapkey if isinstance(mapvalue, tuple): (mapvalue, mapcomment) = mapvalue - if mapkey is None: + if mapkey == -1: continue table[mapkey] = (mapvalue, mapcomment) if mapkey > maxkey: @@ -223,11 +223,11 @@ # Create table code for key in range(maxkey + 1): if key not in table: - mapvalue = None + mapvalue = -1 mapcomment = 'UNDEFINED' else: mapvalue, mapcomment = table[key] - if mapvalue is None: + if mapvalue == -1: mapchar = UNI_UNDEFINED else: if isinstance(mapvalue, tuple):