This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients kbk, ned.deily, roger.serwy, serhiy.storchaka, terry.reedy, tim.peters
Date 2013-11-04.06:55:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I am curious too, so I traced through the call chain.

1343: PseudoOutputFile.write(s) calls:, 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)

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:
but if the insert succeeds, these should not care about the source of the inserted chars.

187: self.text = MultiCallCreator(Text)(text_frame, **text_options)
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/, 3050), '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')

I remain puzzled.
Date User Action Args
2013-11-04 06:55:59terry.reedysetrecipients: + terry.reedy, tim.peters, kbk, ned.deily, roger.serwy, serhiy.storchaka
2013-11-04 06:55:59terry.reedysetmessageid: <>
2013-11-04 06:55:59terry.reedylinkissue19481 messages
2013-11-04 06:55:58terry.reedycreate