Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
203eb317
Commit
203eb317
authored
Aug 22, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj
argument. This is needed for support Tcl/Tk 8.6.
parent
1852b30c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
12 deletions
+60
-12
Lib/test/test_tcl.py
Lib/test/test_tcl.py
+4
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_tkinter.c
Modules/_tkinter.c
+53
-12
No files found.
Lib/test/test_tcl.py
View file @
203eb317
...
@@ -200,6 +200,8 @@ class TclTest(unittest.TestCase):
...
@@ -200,6 +200,8 @@ class TclTest(unittest.TestCase):
(('
a
', 3.4), ('
a
', 3.4)),
(('
a
', 3.4), ('
a
', 3.4)),
((), ()),
((), ()),
(call('
list
', 1, '
2
', (3.4,)), (1, '
2
', (3.4,))),
(call('
list
', 1, '
2
', (3.4,)), (1, '
2
', (3.4,))),
(call('
dict
', '
create
', 1, '
\
u20ac
', b'
\
xe2
\
x82
\
xac
', (3.4,)),
(1, '
\
u20ac
', '
\
u20ac
', (3.4,))),
]
]
for arg, res in testcases:
for arg, res in testcases:
self.assertEqual(splitlist(arg), res, msg=arg)
self.assertEqual(splitlist(arg), res, msg=arg)
...
@@ -232,6 +234,8 @@ class TclTest(unittest.TestCase):
...
@@ -232,6 +234,8 @@ class TclTest(unittest.TestCase):
(('
a
', (2, 3.4)), ('
a
', (2, 3.4))),
(('
a
', (2, 3.4)), ('
a
', (2, 3.4))),
((), ()),
((), ()),
(call('
list
', 1, '
2
', (3.4,)), (1, '
2
', (3.4,))),
(call('
list
', 1, '
2
', (3.4,)), (1, '
2
', (3.4,))),
(call('
dict
', '
create
', 12, '
\
u20ac
', b'
\
xe2
\
x82
\
xac
', (3.4,)),
(12, '
\
u20ac
', '
\
u20ac
', (3.4,))),
]
]
for arg, res in testcases:
for arg, res in testcases:
self.assertEqual(split(arg), res, msg=arg)
self.assertEqual(split(arg), res, msg=arg)
...
...
Misc/NEWS
View file @
203eb317
...
@@ -66,6 +66,9 @@ Core and Builtins
...
@@ -66,6 +66,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #16809: Tkinter'
s
splitlist
()
and
split
()
methods
now
accept
Tcl_Obj
argument
.
-
Issue
#
18324
:
set_payload
now
correctly
handles
binary
input
.
This
also
-
Issue
#
18324
:
set_payload
now
correctly
handles
binary
input
.
This
also
supersedes
the
previous
fixes
for
#
14360
,
#
1717
,
and
#
16564.
supersedes
the
previous
fixes
for
#
14360
,
#
1717
,
and
#
16564.
...
...
Modules/_tkinter.c
View file @
203eb317
...
@@ -1940,16 +1940,35 @@ Tkapp_SplitList(PyObject *self, PyObject *args)
...
@@ -1940,16 +1940,35 @@ Tkapp_SplitList(PyObject *self, PyObject *args)
char
*
list
;
char
*
list
;
int
argc
;
int
argc
;
char
**
argv
;
char
**
argv
;
PyObject
*
v
;
PyObject
*
arg
,
*
v
;
int
i
;
int
i
;
if
(
PyTuple_Size
(
args
)
==
1
)
{
if
(
!
PyArg_ParseTuple
(
args
,
"O:splitlist"
,
&
arg
))
v
=
PyTuple_GetItem
(
args
,
0
);
return
NULL
;
if
(
PyTuple_Check
(
v
))
{
if
(
PyTclObject_Check
(
arg
))
{
Py_INCREF
(
v
);
int
objc
;
return
v
;
Tcl_Obj
**
objv
;
if
(
Tcl_ListObjGetElements
(
Tkapp_Interp
(
self
),
((
PyTclObject
*
)
arg
)
->
value
,
&
objc
,
&
objv
)
==
TCL_ERROR
)
{
return
Tkinter_Error
(
self
);
}
if
(
!
(
v
=
PyTuple_New
(
objc
)))
return
NULL
;
for
(
i
=
0
;
i
<
objc
;
i
++
)
{
PyObject
*
s
=
FromObj
(
self
,
objv
[
i
]);
if
(
!
s
||
PyTuple_SetItem
(
v
,
i
,
s
))
{
Py_DECREF
(
v
);
return
NULL
;
}
}
}
return
v
;
}
}
if
(
PyTuple_Check
(
arg
))
{
Py_INCREF
(
arg
);
return
arg
;
}
if
(
!
PyArg_ParseTuple
(
args
,
"et:splitlist"
,
"utf-8"
,
&
list
))
if
(
!
PyArg_ParseTuple
(
args
,
"et:splitlist"
,
"utf-8"
,
&
list
))
return
NULL
;
return
NULL
;
...
@@ -1980,16 +1999,38 @@ Tkapp_SplitList(PyObject *self, PyObject *args)
...
@@ -1980,16 +1999,38 @@ Tkapp_SplitList(PyObject *self, PyObject *args)
static
PyObject
*
static
PyObject
*
Tkapp_Split
(
PyObject
*
self
,
PyObject
*
args
)
Tkapp_Split
(
PyObject
*
self
,
PyObject
*
args
)
{
{
PyObject
*
v
;
PyObject
*
arg
,
*
v
;
char
*
list
;
char
*
list
;
if
(
PyTuple_Size
(
args
)
==
1
)
{
if
(
!
PyArg_ParseTuple
(
args
,
"O:split"
,
&
arg
))
PyObject
*
o
=
PyTuple_GetItem
(
args
,
0
);
return
NULL
;
if
(
PyTuple_Check
(
o
))
{
if
(
PyTclObject_Check
(
arg
))
{
o
=
SplitObj
(
o
);
Tcl_Obj
*
value
=
((
PyTclObject
*
)
arg
)
->
value
;
return
o
;
int
objc
;
Tcl_Obj
**
objv
;
int
i
;
if
(
Tcl_ListObjGetElements
(
Tkapp_Interp
(
self
),
value
,
&
objc
,
&
objv
)
==
TCL_ERROR
)
{
return
FromObj
(
self
,
value
);
}
}
if
(
objc
==
0
)
return
PyUnicode_FromString
(
""
);
if
(
objc
==
1
)
return
FromObj
(
self
,
objv
[
0
]);
if
(
!
(
v
=
PyTuple_New
(
objc
)))
return
NULL
;
for
(
i
=
0
;
i
<
objc
;
i
++
)
{
PyObject
*
s
=
FromObj
(
self
,
objv
[
i
]);
if
(
!
s
||
PyTuple_SetItem
(
v
,
i
,
s
))
{
Py_DECREF
(
v
);
return
NULL
;
}
}
return
v
;
}
}
if
(
PyTuple_Check
(
arg
))
return
SplitObj
(
arg
);
if
(
!
PyArg_ParseTuple
(
args
,
"et:split"
,
"utf-8"
,
&
list
))
if
(
!
PyArg_ParseTuple
(
args
,
"et:split"
,
"utf-8"
,
&
list
))
return
NULL
;
return
NULL
;
v
=
Split
(
list
);
v
=
Split
(
list
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment