]> granicus.if.org Git - python/commitdiff
merge 3.2
authorMartin v. Löwis <martin@v.loewis.de>
Wed, 25 Jul 2012 09:33:02 +0000 (11:33 +0200)
committerMartin v. Löwis <martin@v.loewis.de>
Wed, 25 Jul 2012 09:33:02 +0000 (11:33 +0200)
1  2 
Lib/idlelib/NEWS.txt
Lib/idlelib/PyShell.py

index 6b430b5bf15525908909f90673dae67802c270d4,3a641a019eb973a7a9abcdcc3baf86b2c8e48670..1d87443bd49b289472bf98161a43e75d661691ac
@@@ -1,11 -1,10 +1,13 @@@
 -What's New in IDLE 3.2.4?
 +What's New in IDLE 3.3.0?
  =========================
  
+ - Issue #7163: Propagate return value of sys.stdout.write.
  - Issue #15318: Prevent writing to sys.stdin.
  
 +- Issue #4832: Modify IDLE to save files with .py extension by
 +  default on Windows and OS X (Tk 8.5) as it already does with X11 Tk.
 +
  - Issue #13532, #15319: Check that arguments to sys.stdout.write are strings.
  
  - Issue # 12510: Attempt to get certain tool tips no longer crashes IDLE.
index 0a05d78456b7bd9bc65881e3ee9d4a602a1e238d,0eae7c5cee38876a86af8e84c8cb48186e272437..e0b8c29816842d55d46bdb4dbb9481774143c39e
@@@ -1233,19 -1227,9 +1233,19 @@@ 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")
+             count = OutputWindow.write(self, s, tags, "iomark")
              self.text.mark_gravity("iomark", "left")
          except:
              raise ###pass  # ### 11Aug07 KBK if we are expecting exceptions