Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed0b87d

Browse files
committed
Fix the C definition of the sys._debugmallocstats() function: the function has
no parameter
1 parent 36e96b8 commit ed0b87d

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/test/test_sys.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,9 @@ def test_debugmallocstats(self):
665665
ret, out, err = assert_python_ok(*args)
666666
self.assertIn(b"free PyDictObjects", err)
667667

668+
# The function has no parameter
669+
self.assertRaises(TypeError, sys._debugmallocstats, True)
670+
668671
@unittest.skipUnless(hasattr(sys, "getallocatedblocks"),
669672
"sys.getallocatedblocks unavailable on this build")
670673
def test_getallocatedblocks(self):

Python/sysmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ static PyMethodDef sys_methods[] = {
11861186
{"settrace", sys_settrace, METH_O, settrace_doc},
11871187
{"gettrace", sys_gettrace, METH_NOARGS, gettrace_doc},
11881188
{"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
1189-
{"_debugmallocstats", sys_debugmallocstats, METH_VARARGS,
1189+
{"_debugmallocstats", sys_debugmallocstats, METH_NOARGS,
11901190
debugmallocstats_doc},
11911191
{NULL, NULL} /* sentinel */
11921192
};

0 commit comments

Comments
 (0)