diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-10-03 20:50:46 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-10-03 20:50:46 (GMT) |
commit | a65b2420f681c45db43e94bfe3dc50ad1dfcd03d (patch) | |
tree | 6f3b554982f61889a3a1049586c187bd3950a66f /Lib | |
parent | fcc832a4fafcbbaca5484ed0274935e14c9dcf6b (diff) | |
download | cpython-a65b2420f681c45db43e94bfe3dc50ad1dfcd03d.zip cpython-a65b2420f681c45db43e94bfe3dc50ad1dfcd03d.tar.gz cpython-a65b2420f681c45db43e94bfe3dc50ad1dfcd03d.tar.bz2 |
[3.6] bpo-31675: Fix memory leaks in Tkinter's methods splitlist() and split() (GH-3866) (#3874)
when pass a string larger than 2 GiB.
Decrease memory requirements for Tcl's bigmem tests.
(cherry picked from commit 27c623c845dd6e4b8e1782666ca3a956636da266)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_tcl.py | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index 8ffd185..db99b75 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -662,32 +662,44 @@ class BigmemTclTest(unittest.TestCase): @support.bigmemtest(size=INT_MAX + 1, memuse=5, dry_run=False) def test_huge_string_call(self, size): value = ' ' * size - self.assertRaises(OverflowError, self.interp.call, 'set', '_', value) + self.assertRaises(OverflowError, self.interp.call, 'string', 'index', value, 0) @support.cpython_only @unittest.skipUnless(INT_MAX < PY_SSIZE_T_MAX, "needs UINT_MAX < SIZE_MAX") - @support.bigmemtest(size=INT_MAX + 1, memuse=9, dry_run=False) + @support.bigmemtest(size=INT_MAX + 1, memuse=2, dry_run=False) def test_huge_string_builtins(self, size): + tk = self.interp.tk value = '1' + ' ' * size - self.assertRaises(OverflowError, self.interp.tk.getint, value) - self.assertRaises(OverflowError, self.interp.tk.getdouble, value) - self.assertRaises(OverflowError, self.interp.tk.getboolean, value) - self.assertRaises(OverflowError, self.interp.eval, value) - self.assertRaises(OverflowError, self.interp.evalfile, value) - self.assertRaises(OverflowError, self.interp.record, value) - self.assertRaises(OverflowError, self.interp.adderrorinfo, value) - self.assertRaises(OverflowError, self.interp.setvar, value, 'x', 'a') - self.assertRaises(OverflowError, self.interp.setvar, 'x', value, 'a') - self.assertRaises(OverflowError, self.interp.unsetvar, value) - self.assertRaises(OverflowError, self.interp.unsetvar, 'x', value) - self.assertRaises(OverflowError, self.interp.adderrorinfo, value) - self.assertRaises(OverflowError, self.interp.exprstring, value) - self.assertRaises(OverflowError, self.interp.exprlong, value) - self.assertRaises(OverflowError, self.interp.exprboolean, value) - self.assertRaises(OverflowError, self.interp.splitlist, value) - self.assertRaises(OverflowError, self.interp.split, value) - self.assertRaises(OverflowError, self.interp.createcommand, value, max) - self.assertRaises(OverflowError, self.interp.deletecommand, value) + self.assertRaises(OverflowError, tk.getint, value) + self.assertRaises(OverflowError, tk.getdouble, value) + self.assertRaises(OverflowError, tk.getboolean, value) + self.assertRaises(OverflowError, tk.eval, value) + self.assertRaises(OverflowError, tk.evalfile, value) + self.assertRaises(OverflowError, tk.record, value) + self.assertRaises(OverflowError, tk.adderrorinfo, value) + self.assertRaises(OverflowError, tk.setvar, value, 'x', 'a') + self.assertRaises(OverflowError, tk.setvar, 'x', value, 'a') + self.assertRaises(OverflowError, tk.unsetvar, value) + self.assertRaises(OverflowError, tk.unsetvar, 'x', value) + self.assertRaises(OverflowError, tk.adderrorinfo, value) + self.assertRaises(OverflowError, tk.exprstring, value) + self.assertRaises(OverflowError, tk.exprlong, value) + self.assertRaises(OverflowError, tk.exprboolean, value) + self.assertRaises(OverflowError, tk.splitlist, value) + self.assertRaises(OverflowError, tk.split, value) + self.assertRaises(OverflowError, tk.createcommand, value, max) + self.assertRaises(OverflowError, tk.deletecommand, value) + + @support.cpython_only + @unittest.skipUnless(INT_MAX < PY_SSIZE_T_MAX, "needs UINT_MAX < SIZE_MAX") + @support.bigmemtest(size=INT_MAX + 1, memuse=6, dry_run=False) + def test_huge_string_builtins2(self, size): + # These commands require larger memory for possible error messages + tk = self.interp.tk + value = '1' + ' ' * size + self.assertRaises(OverflowError, tk.evalfile, value) + self.assertRaises(OverflowError, tk.unsetvar, value) + self.assertRaises(OverflowError, tk.unsetvar, 'x', value) def setUpModule(): |