Message268883
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? |
|
Date |
User |
Action |
Args |
2016-06-20 03:25:20 | terry.reedy | set | recipients:
+ terry.reedy, gpolo, serhiy.storchaka |
2016-06-20 03:25:20 | terry.reedy | set | messageid: <1466393120.57.0.596231927009.issue22214@psf.upfronthosting.co.za> |
2016-06-20 03:25:20 | terry.reedy | link | issue22214 messages |
2016-06-20 03:25:19 | terry.reedy | create | |
|