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
d05b000c
Commit
d05b000c
authored
Oct 08, 2019
by
Serhiy Storchaka
Committed by
GitHub
Oct 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-38371: Tkinter: deprecate the split() method. (GH-16584)
parent
d7c38738
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
4 deletions
+23
-4
Doc/whatsnew/3.9.rst
Doc/whatsnew/3.9.rst
+5
-0
Lib/test/test_tcl.py
Lib/test/test_tcl.py
+9
-4
Misc/NEWS.d/next/Library/2019-10-04-18-39-59.bpo-38371.S6Klvm.rst
...S.d/next/Library/2019-10-04-18-39-59.bpo-38371.S6Klvm.rst
+3
-0
Modules/_tkinter.c
Modules/_tkinter.c
+6
-0
No files found.
Doc/whatsnew/3.9.rst
View file @
d05b000c
...
...
@@ -191,6 +191,11 @@ Deprecated
the module will restrict its seeds to :const:`None`, :class:`int`,
:class:`float`, :class:`str`, :class:`bytes`, and :class:`bytearray`.
* Deprecated the ``split()`` method of :class:`_tkinter.TkappType` in
favour of the ``splitlist()`` method which has more consistent and
predicable behavior.
(Contributed by Serhiy Storchaka in :issue:`38371`.)
Removed
=======
...
...
Lib/test/test_tcl.py
View file @
d05b000c
...
...
@@ -3,6 +3,7 @@ import re
import
subprocess
import
sys
import
os
import
warnings
from
test
import
support
# Skip this test if the _tkinter module wasn't built.
...
...
@@ -573,9 +574,12 @@ class TclTest(unittest.TestCase):
def test_split(self):
split = self.interp.tk.split
call = self.interp.tk.call
self.assertRaises(TypeError, split)
self.assertRaises(TypeError, split, '
a
', 'b')
self.assertRaises(TypeError, split, 2)
with warnings.catch_warnings():
warnings.filterwarnings('
ignore
', r'
\
bsplit
\
b
.
*
\
bsplitlist
\
b',
DeprecationWarning)
self.assertRaises(TypeError, split)
self.assertRaises(TypeError, split, '
a
', 'b')
self.assertRaises(TypeError, split, 2)
testcases = [
('
2
', '
2
'),
('', ''),
...
...
@@ -617,7 +621,8 @@ class TclTest(unittest.TestCase):
expected),
]
for arg, res in testcases:
self.assertEqual(split(arg), res, msg=arg)
with self.assertWarns(DeprecationWarning):
self.assertEqual(split(arg), res, msg=arg)
def test_splitdict(self):
splitdict = tkinter._splitdict
...
...
Misc/NEWS.d/next/Library/2019-10-04-18-39-59.bpo-38371.S6Klvm.rst
0 → 100644
View file @
d05b000c
Deprecated the ``split()`` method in :class:`_tkinter.TkappType` in favour
of the ``splitlist()`` method which has more consistent and predicable
behavior.
Modules/_tkinter.c
View file @
d05b000c
...
...
@@ -2304,6 +2304,12 @@ _tkinter_tkapp_split(TkappObject *self, PyObject *arg)
PyObject
*
v
;
char
*
list
;
if
(
PyErr_WarnEx
(
PyExc_DeprecationWarning
,
"split() is deprecated; consider using splitlist() instead"
,
1
))
{
return
NULL
;
}
if
(
PyTclObject_Check
(
arg
))
{
Tcl_Obj
*
value
=
((
PyTclObject
*
)
arg
)
->
value
;
int
objc
;
...
...
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