[issue14777] Tkinter clipboard_get() decodes characters incorrectly

Ned Deily report at bugs.python.org
Mon May 14 02:40:22 CEST 2012


Ned Deily <nad at acm.org> added the comment:

Serhiy, I don't know why Misc.Tk is not module level but it isn't so caching global attributes there isn't effective.  However, upon further consideration, I take back my original suggestion of caching at the module level primarily because I can think of future scenarios where it might be possible that there are different windowing systems supported in the same Python instance.  I now think the best solution is to cache at the Tk root object level; that appears to be a simple change to Thomas's 2nd revision.  Sorry about that!  Here is a fourth version (one for 3.x and one for 2.7) based on the second which includes the fix from the 3rd.

I started to write a simple test for the clipboard functions but then realized that there doesn't seem to be a practical way to effectively test in a machine-independent way without destroying the contents of the Tk clipboard and hence the user's desktop clipboard, not a friendly thing to do.  For example, the clipboard might contain a data type not supported by the platform's Tk, like pict data on OS X.  So I'm not including the test here but it did verify that the attribute was being properly cached across multiple tkinter objects.

Thanks to Thomas for the patch and to Serhiy for reviewing.  By the way, Thomas, for your patch to be included, you should submit a PSF contributor agreement as described here:  http://www.python.org/psf/contrib/.  Once that is in place and if the patch looks good to everyone, I'll apply it.

----------
stage:  -> patch review
Added file: http://bugs.python.org/file25571/x11-clipboard-try-utf8-4.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14777>
_______________________________________


More information about the Python-bugs-list mailing list