Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/Pythonwin/pywin/idle
Modified Files:
PyParse.py
Log Message:
Various modernizations to .py code via the py3k branch.
Index: PyParse.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/PyParse.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PyParse.py 9 Aug 2008 16:47:07 -0000 1.5
--- PyParse.py 14 Nov 2008 00:22:25 -0000 1.6
***************
*** 3,13 ****
import sys
- try:
- from types import UnicodeType
- except ImportError:
- from pywintypes import UnicodeType
-
# Reason last stmt is continued (or C_NONE if it's not).
! C_NONE, C_BACKSLASH, C_STRING, C_BRACKET = range(4)
if 0: # for throwaway debugging output
--- 3,8 ----
import sys
# Reason last stmt is continued (or C_NONE if it's not).
! C_NONE, C_BACKSLASH, C_STRING, C_BRACKET = list(range(4))
if 0: # for throwaway debugging output
***************
*** 119,135 ****
def set_str(self, str):
assert len(str) == 0 or str[-1] == '\n', "Oops - have str %r" % (str,)
- if type(str) == 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
- # of Python are 7-bit ASCII. It's *necessary* because Unicode
- # strings don't have a .translate() method that supports
- # deletechars.
- uniphooey = str
- str = []
- push = str.append
- for raw in map(ord, uniphooey):
- push(raw < 127 and chr(raw) or "x")
- str = "".join(str)
self.str = str
self.study_level = 0
--- 114,117 ----
|