Issue #18101: Tcl.split() now process strings nested in a tuple as it

do with byte strings.

Added tests for Tcl.split() and Tcl.splitline().
This commit is contained in:
Serhiy Storchaka 2013-07-11 20:34:47 +03:00
parent 5a33f81348
commit 275d5fdbe4
3 changed files with 78 additions and 0 deletions

View file

@ -519,6 +519,21 @@ SplitObj(PyObject *arg)
return result;
/* Fall through, returning arg. */
}
else if (PyUnicode_Check(arg)) {
int argc;
char **argv;
char *list = PyUnicode_AsUTF8(arg);
if (list == NULL ||
Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
Py_INCREF(arg);
return arg;
}
Tcl_Free(FREECAST argv);
if (argc > 1)
return Split(list);
/* Fall through, returning arg. */
}
else if (PyBytes_Check(arg)) {
int argc;
char **argv;