Hack to make this still work with Python 1.5.2. ;-(

This commit is contained in:
Fred Drake 2001-02-16 22:13:48 +00:00
parent 7df9c60b8a
commit f5d2fdf164
1 changed files with 6 additions and 1 deletions

View File

@ -105,6 +105,11 @@ def dump(*stuff):
_tran = string.join(_tran, '')
del ch
try:
UnicodeType = type(unicode(""))
except NameError:
UnicodeType = None
class Parser:
def __init__(self, indentwidth, tabwidth):
@ -113,7 +118,7 @@ def __init__(self, indentwidth, tabwidth):
def set_str(self, str):
assert len(str) == 0 or str[-1] == '\n'
if type(str) == type(u""):
if type(str) is UnicodeType:
# The parse functions have no idea what to do with Unicode, so
# replace all Unicode characters with "x". This is "safe"
# so long as the only characters germane to parsing the structure