Author terry.reedy
Recipients ezio.melotti, loewis, ned.deily, roger.serwy, terry.reedy, vbr, vstinner
Date 2012-03-05.18:00:14
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1330970415.83.0.0500569891289.issue14200@psf.upfronthosting.co.za>
In-reply-to
Content
On 3.2.2, Win7, the length is 2 and printing in Idle prints a square, as it usually does for chars it cannot print. I presume Tk recognizes surrogate pairs. Printing to the screen should not raise an exception, so the square would be better. Even better would be to do what the 3.2 and 3.3 Command Prompt Interpreters do, which is to print an evaluable representation:

>>> c
'\U00010330'

I assume that this string is produced by python.exe rather than Windows. If so, neither of the two pythonw processes is currently doing the same conversion. My understanding is that the user pythonw process uses idlelib.rpc.RPCproxy objects to ship i/o calls to the idle pythonw process.

I presume we could find the idle process window .write methods and change lines like
        self.text.insert(mark, s, tags)
to
        try:
            self.text.insert(mark, s, tags)
        except SomeTkError:
            self.text.insert(mark, expand(s), tags)
But it seems to me that the expansion should really be done in C in _tkinter, where the internal .kind attribute of strings is available. 

---
There is also an input crash. On 3.2, I tried to cut the square char and paste it into "ord('')" (both shell and edit window) to see what unicode char it is and IDLE fades away as you describe. That puzzles me, as I am normally able to paste BMP chars into idle without problem. In any case, I presume the problem is not idle-specific and would best be handled in _tkinter. Or does the crash happen in Windows or tcl/tk code before _tkinter ever sees the input?

When I paste the same into the 3.2 or 3.2 interpreter, it is converted to ascii '?'. I presume this is done by Windows Command Prompt before sending anything to python.
History
Date User Action Args
2012-03-05 18:00:15terry.reedysetrecipients: + terry.reedy, loewis, vstinner, vbr, ned.deily, ezio.melotti, roger.serwy
2012-03-05 18:00:15terry.reedysetmessageid: <1330970415.83.0.0500569891289.issue14200@psf.upfronthosting.co.za>
2012-03-05 18:00:15terry.reedylinkissue14200 messages
2012-03-05 18:00:14terry.reedycreate