[Idle-dev] CVS: idle PyShell.py,1.24,1.25
Kurt B. Kaiser
kbk@users.sourceforge.net
Tue, 17 Sep 2002 19:30:01 -0700
Update of /cvsroot/idlefork/idle
In directory usw-pr-cvs1:/tmp/cvs-serv20002
Modified Files:
PyShell.py
Log Message:
Merge Py Idle changes:
Rev 1.35 fdrake
Use string.ascii_letters instead of string.letters (SF bug #226706).
Move computation of sets of characters out of the body of the function
that uses them.
Rev 1.36 tim_one
Convert a pile of obvious "yes/no" functions to return bool
Rev 1.37
(skip, done differently in Idlefork)
Rev 1.38 loewis
Patch #590913: PEP 263 support.
Rev 1.39 loewis
Convert characters from the locale's encoding on output.
Reject characters outside the locale's encoding on input.
Rev 1.40 doerwalter
(string methods)
Rev 1.41
(skipped, done by GvR in rpc)
Index: PyShell.py
===================================================================
RCS file: /cvsroot/idlefork/idle/PyShell.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** PyShell.py 14 Sep 2002 02:50:56 -0000 1.24
--- PyShell.py 18 Sep 2002 02:29:59 -0000 1.25
***************
*** 290,293 ****
--- 290,301 ----
self.save_warnings_filters = warnings.filters[:]
warnings.filterwarnings(action="error", category=SyntaxWarning)
+ if isinstance(source, types.UnicodeType):
+ import IOBinding
+ try:
+ source = source.encode(IOBinding.encoding)
+ except UnicodeError:
+ self.tkconsole.resetoutput()
+ self.write("Unsupported characters in input")
+ return
try:
return InteractiveInterpreter.runsource(self, source, filename)
***************
*** 301,308 ****
filename = "<pyshell#%d>" % self.gid
self.gid = self.gid + 1
! lines = string.split(source, "\n")
linecache.cache[filename] = len(source)+1, 0, lines, filename
return filename
!
def showsyntaxerror(self, filename=None):
"""Extend base class method: Add Colorizing
--- 309,318 ----
filename = "<pyshell#%d>" % self.gid
self.gid = self.gid + 1
! lines = source.split("\n")
linecache.cache[filename] = len(source)+1, 0, lines, filename
return filename
!
! IDENTCHARS = string.ascii_letters + string.digits + "_"
!
def showsyntaxerror(self, filename=None):
"""Extend base class method: Add Colorizing
***************
*** 327,331 ****
text.see(pos)
char = text.get(pos)
! if char and char in string.letters + string.digits + "_":
text.tag_add("ERROR", pos + " wordstart", pos)
self.tkconsole.resetoutput()
--- 337,341 ----
text.see(pos)
char = text.get(pos)
! if char and char in IDENTCHARS:
text.tag_add("ERROR", pos + " wordstart", pos)
self.tkconsole.resetoutput()
***************
*** 599,603 ****
def ispythonsource(self, filename):
"Override EditorWindow method: never remove the colorizer"
! return 1
def short_title(self):
--- 609,613 ----
def ispythonsource(self, filename):
"Override EditorWindow method: never remove the colorizer"
! return True
def short_title(self):
***************
*** 642,646 ****
def isatty(self):
! return 1
def cancel_callback(self, event):
--- 652,656 ----
def isatty(self):
! return True
def cancel_callback(self, event):
***************
*** 736,740 ****
# beyond the cursor, erase that whitespace first
s = self.text.get("insert", "end-1c")
! if s and not string.strip(s):
self.text.delete("insert", "end-1c")
# If we're in the current input before its last line,
--- 746,750 ----
# beyond the cursor, erase that whitespace first
s = self.text.get("insert", "end-1c")
! if s and not s.strip():
self.text.delete("insert", "end-1c")
# If we're in the current input before its last line,
***************
*** 853,857 ****
def isatty(self):
! return 1
--- 863,867 ----
def isatty(self):
! return True