Issue 18101: Tk.split() doesn't work with nested Unicode strings (original) (raw)

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().