Terry J. Reedy added the comment:
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?
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22214>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com