classification
Title: Tk.split() doesn't work with nested Unicode strings
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.4, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Arfrever, ezio.melotti, gpolo, python-dev, roger.serwy, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2013-05-30 13:59 by serhiy.storchaka, last changed 2013-07-11 17:54 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
tkinter_split_nested_unicode.patch serhiy.storchaka, 2013-05-30 13:59 Patch for 3.3+ review
tkinter_split_nested_unicode-2.7.patch serhiy.storchaka, 2013-05-30 14:18 Patch for 2.7 review
tkinter_split_nested_unicode_2.patch serhiy.storchaka, 2013-06-09 17:57 Patch for 3.3+ review
tkinter_split_nested_unicode-2.7_2.patch serhiy.storchaka, 2013-06-09 17:58 Patch for 2.7 review
Messages (4)
msg190359 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-05-30 13:59
Tk.split() doesn't work with nested Unicode strings, but works with nested bytes.

>>> import tkinter
>>> t = tkinter.Tcl()
>>> t.split('a {b c}')
('a', ('b', 'c'))
>>> t.split(b'a {b c}')
('a', ('b', 'c'))
>>> t.split(('a {b c}',))
('a {b c}',)
>>> t.split((b'a {b c}',))
(('a', ('b', 'c')),)

I think this is unintentional. Here is a patch which processes strings inside a tuple as bytes objects. It also adds tests for Tk.splitline() and Tk.split().
msg190867 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-06-09 17:32
Ezio, have you reviewed the main code?
msg190868 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-06-09 17:57
Here are patches with updated tests as Ezio suggested.
msg192882 - (view) Author: Roundup Robot (python-dev) Date: 2013-07-11 17:38
New changeset f53cdd4e2689 by Serhiy Storchaka in branch '2.7':
Issue #18101: Tcl.split() now process Unicode strings nested in a tuple as it
http://hg.python.org/cpython/rev/f53cdd4e2689

New changeset 9486c07929a1 by Serhiy Storchaka in branch '3.3':
Issue #18101: Tcl.split() now process strings nested in a tuple as it
http://hg.python.org/cpython/rev/9486c07929a1

New changeset 16c48d553ddb by Serhiy Storchaka in branch 'default':
Issue #18101: Tcl.split() now process strings nested in a tuple as it
http://hg.python.org/cpython/rev/16c48d553ddb
History
Date User Action Args
2013-08-03 21:00:15serhiy.storchakalinkissue17478 superseder
2013-07-11 17:54:57serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-07-11 17:38:37python-devsetnosy: + python-dev
messages: + msg192882
2013-06-09 17:58:33serhiy.storchakasetfiles: + tkinter_split_nested_unicode-2.7_2.patch
2013-06-09 17:57:35serhiy.storchakasetfiles: + tkinter_split_nested_unicode_2.patch

messages: + msg190868
2013-06-09 17:32:06serhiy.storchakasetmessages: + msg190867
2013-06-08 22:55:47serhiy.storchakasetassignee: serhiy.storchaka
2013-06-03 22:47:22ezio.melottisetnosy: + ezio.melotti
2013-05-30 15:38:51Arfreversetnosy: + Arfrever
2013-05-30 14:45:33serhiy.storchakalinkissue16809 dependencies
2013-05-30 14:18:21serhiy.storchakasetfiles: + tkinter_split_nested_unicode-2.7.patch
nosy: + gpolo, roger.serwy

versions: + Python 2.7
2013-05-30 13:59:21serhiy.storchakacreate