Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5d2fdf

Browse files
committed
Hack to make this still work with Python 1.5.2. ;-(
1 parent 7df9c60 commit f5d2fdf

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Tools/idle/PyParse.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ def dump(*stuff):
105105
_tran = string.join(_tran, '')
106106
del ch
107107

108+
try:
109+
UnicodeType = type(unicode(""))
110+
except NameError:
111+
UnicodeType = None
112+
108113
class Parser:
109114

110115
def __init__(self, indentwidth, tabwidth):
@@ -113,7 +118,7 @@ def __init__(self, indentwidth, tabwidth):
113118

114119
def set_str(self, str):
115120
assert len(str) == 0 or str[-1] == '\n'
116-
if type(str) == type(u""):
121+
if type(str) is UnicodeType:
117122
# The parse functions have no idea what to do with Unicode, so
118123
# replace all Unicode characters with "x". This is "safe"
119124
# so long as the only characters germane to parsing the structure

0 commit comments

Comments
 (0)