Closes #19786: tracemalloc, remove the arbitrary limit of 100 frames

The limit is now 178,956,969 on 64 bit (it is greater on 32 bit because
structures are smaller).

Use int instead of Py_ssize_t to store the number of frames to have smaller
traceback_t objects.
This commit is contained in:
Victor Stinner 2013-11-27 22:27:13 +01:00
parent 3c0481d426
commit f28ce60441
2 changed files with 40 additions and 27 deletions

View file

@ -747,14 +747,14 @@ class TestCommandLine(unittest.TestCase):
self.assertEqual(stdout, b'10')
def test_env_var_invalid(self):
for nframe in (-1, 0, 5000):
for nframe in (-1, 0, 2**30):
with self.subTest(nframe=nframe):
with support.SuppressCrashReport():
ok, stdout, stderr = assert_python_failure(
'-c', 'pass',
PYTHONTRACEMALLOC=str(nframe))
self.assertIn(b'PYTHONTRACEMALLOC must be an integer '
b'in range [1; 100]',
self.assertIn(b'PYTHONTRACEMALLOC: invalid '
b'number of frames',
stderr)
def test_sys_xoptions(self):
@ -770,13 +770,13 @@ class TestCommandLine(unittest.TestCase):
self.assertEqual(stdout, str(nframe).encode('ascii'))
def test_sys_xoptions_invalid(self):
for nframe in (-1, 0, 5000):
for nframe in (-1, 0, 2**30):
with self.subTest(nframe=nframe):
with support.SuppressCrashReport():
args = ('-X', 'tracemalloc=%s' % nframe, '-c', 'pass')
ok, stdout, stderr = assert_python_failure(*args)
self.assertIn(b'-X tracemalloc=NFRAME: number of frame must '
b'be an integer in range [1; 100]',
self.assertIn(b'-X tracemalloc=NFRAME: invalid '
b'number of frames',
stderr)