]> granicus.if.org Git - python/commitdiff
Hack to make this still work with Python 1.5.2. ;-(
authorFred Drake <fdrake@acm.org>
Fri, 16 Feb 2001 22:13:48 +0000 (22:13 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 16 Feb 2001 22:13:48 +0000 (22:13 +0000)
Tools/idle/PyParse.py

index ac68caae255ea110c7b0c370d3501a71b0fb35b6..a51235620d75f4c1ea1f9a867faf8e40bb474a4f 100644 (file)
@@ -105,6 +105,11 @@ for ch in "\"'\\\n#":
 _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 @@ class Parser:
 
     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