diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-07-14 05:19:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-14 05:19:18 (GMT) |
commit | f572cbf1faab33d9afbbe3e95738ed6fbe6e48e6 (patch) | |
tree | d03a1b3e8bb70c75a1f0a7e3cdeaaf419ed05db6 /Lib/test/test_tcl.py | |
parent | 81989058de381108dfd0a4255b93d4fb34417002 (diff) | |
download | cpython-f572cbf1faab33d9afbbe3e95738ed6fbe6e48e6.zip cpython-f572cbf1faab33d9afbbe3e95738ed6fbe6e48e6.tar.gz cpython-f572cbf1faab33d9afbbe3e95738ed6fbe6e48e6.tar.bz2 |
bpo-44608: Fix memory leak in _tkinter._flatten() (GH-27107)
if it is called with a sequence or set, but not list or tuple.
Diffstat (limited to 'Lib/test/test_tcl.py')
-rw-r--r-- | Lib/test/test_tcl.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index e7a60db..6e5ef09 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -43,8 +43,14 @@ def get_tk_patchlevel(): class TkinterTest(unittest.TestCase): def testFlattenLen(self): - # flatten(<object with no length>) + # Object without length. self.assertRaises(TypeError, _tkinter._flatten, True) + # Object with length, but not sequence. + self.assertRaises(TypeError, _tkinter._flatten, {}) + # Sequence or set, but not tuple or list. + # (issue44608: there were leaks in the following cases) + self.assertRaises(TypeError, _tkinter._flatten, 'string') + self.assertRaises(TypeError, _tkinter._flatten, {'set'}) class TclTest(unittest.TestCase): |