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 gpolo, serhiy.storchaka, terry.reedy
Date 2016-06-20.03:25:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Review works.  "to Python function" should be either "to a Python function" or "to Python functions".

Preventing crashes is a justifying use case.  Percolator registers its 'insert' and 'delete' methods with a WidgetRedirector.  It then patches them into to text instance, thereby inducing tk to call its replacements without their being registered with tk. Can you add a test case based on this?

I tried the following, based on what Redirector does, without and with the patch and got the same result each time.
import tkinter as tk
root = tk.Tk()
text = tk.Text(root)
s = '\ud800'
text.insert('1.0', s)
def insert(index, s):
    Text.insert(text, index, s)
text.insert('1.1', s)
text.insert('1.2', text.clipboard_get())
### output
Traceback (most recent call last):
  File "F:\Python\mypy\", line 12, in <module>
    text.insert('1.2', text.clipboard_get())
  File "F:\Python\dev\36\lib\tkinter\", line 730, in clipboard_get
    return'clipboard', 'get') + self._options(kw))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 0: invalid continuation byte

Can the above be changed to fail, then succeed?
Date User Action Args
2016-06-20 03:25:20terry.reedysetrecipients: + terry.reedy, gpolo, serhiy.storchaka
2016-06-20 03:25:20terry.reedysetmessageid: <>
2016-06-20 03:25:20terry.reedylinkissue22214 messages
2016-06-20 03:25:19terry.reedycreate