summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/PyShell.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-03-14 21:00:31 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-03-14 21:00:31 (GMT)
commite7c8fdee18494238cc93eb895001398ceb7d12fb (patch)
tree50106507b690bced1f2531abecbcd69db0bc50d2 /Lib/idlelib/PyShell.py
parent2f9bf3500715bc55a22fbfac3d8853e4ec4c0ed7 (diff)
parent8247b188f3f6b0d10a9a5effac6897e3ff542c11 (diff)
downloadcpython-e7c8fdee18494238cc93eb895001398ceb7d12fb.zip
cpython-e7c8fdee18494238cc93eb895001398ceb7d12fb.tar.gz
cpython-e7c8fdee18494238cc93eb895001398ceb7d12fb.tar.bz2
merge heads
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r--Lib/idlelib/PyShell.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index f884b28..6b75a8d 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1221,6 +1221,16 @@ class PyShell(OutputWindow):
self.set_line_and_column()
def write(self, s, tags=()):
+ if isinstance(s, str) and len(s) and max(s) > '\uffff':
+ # Tk doesn't support outputting non-BMP characters
+ # Let's assume what printed string is not very long,
+ # find first non-BMP character and construct informative
+ # UnicodeEncodeError exception.
+ for start, char in enumerate(s):
+ if char > '\uffff':
+ break
+ raise UnicodeEncodeError("UCS-2", char, start, start+1,
+ 'Non-BMP character not supported in Tk')
try:
self.text.mark_gravity("iomark", "right")
OutputWindow.write(self, s, tags, "iomark")