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 <1466393120.57.0.596231927009.issue22214@psf.upfronthosting.co.za>
In-reply-to
Content
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)
print(text.get('1.0'))
def insert(index, s):
    Text.insert(text, index, s)
text.insert('1.1', s)
print(text.get('1.1'))
root.clipboard_append(s)
text.insert('1.2', text.clipboard_get())
print(text.get('1.2'))
### output
�
�
Traceback (most recent call last):
  File "F:\Python\mypy\tem2.py", line 12, in <module>
    text.insert('1.2', text.clipboard_get())
  File "F:\Python\dev\36\lib\tkinter\__init__.py", line 730, in clipboard_get
    return self.tk.call(('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?
History
Date User Action Args
2016-06-20 03:25:20terry.reedysetrecipients: + terry.reedy, gpolo, serhiy.storchaka
2016-06-20 03:25:20terry.reedysetmessageid: <1466393120.57.0.596231927009.issue22214@psf.upfronthosting.co.za>
2016-06-20 03:25:20terry.reedylinkissue22214 messages
2016-06-20 03:25:19terry.reedycreate