Terry J. Reedy added the comment:

I am curious too, so I traced through the call chain.

In PyShell.py
1343: PseudoOutputFile.write(s) calls: self.shell.write(s, self.tags)
914: shell is an instance of PyShell and self.tags is 'stdout', 'stderr', or 
'console'.
1291: PyShell.write(s,tags) calls:
 OutputWindow.write(self, s, tags, "iomark")
 (where 'iomark' must have been defined elsewhere, and the 'gravity' calls 
should not matter)

In OutputWindow.py
46: OutputWindow(EditorWindow).write(s,tags,mark='insert') calls: 
self.text.insert(mark, s, tags)
after trying to encode s if isinstance(s, str). It follows with:
        self.text.see(mark)
        self.text.update()
but if the insert succeeds, these should not care about the source of the 
inserted chars.

In EditorWindow.py
187: self.text = MultiCallCreator(Text)(text_frame, **text_options)
In MultiCall.py,
304: MultiCallCreator wraps a tk widget in a MultiCall instance that adds event 
methods but otherwise passes calls to the tk widget.

So PseudoOutputFile(s) becomes tk.Text().insert('iomark', s, 'stdout').
which becomes (lib-tk/tkinter.py, 3050)
  self.tk.call((self._w, 'insert', 'iomark', s) + args)

Tk handles either Latin-1 bytes or BMP unicode. It seems fine with a unicode 
subclass:
>>> import Tkinter as tk
>>> t = tk.Text()
>>> class F(unicode): pass

>>> f = F('foo')
>>> t.insert('1.0', u'abc', 'stdout') # 'iomark' is not defined
>>> t.insert('1.0', f, 'stdout')
>>> t.get('1.0', 'end')
u'abcfoo\n'

I remain puzzled.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19481>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to