mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
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:
parent
5a33f81348
commit
275d5fdbe4
3 changed files with 78 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue