summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tcl.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-07-14 05:19:18 (GMT)
committerGitHub <noreply@github.com>2021-07-14 05:19:18 (GMT)
commitf572cbf1faab33d9afbbe3e95738ed6fbe6e48e6 (patch)
treed03a1b3e8bb70c75a1f0a7e3cdeaaf419ed05db6 /Lib/test/test_tcl.py
parent81989058de381108dfd0a4255b93d4fb34417002 (diff)
downloadcpython-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.py8
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):