summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorINADA Naoki <songofacandy@gmail.com>2016-12-20 00:54:24 (GMT)
committerINADA Naoki <songofacandy@gmail.com>2016-12-20 00:54:24 (GMT)
commit6165d55f1398ddf1cbd21e237129af7116a1fa73 (patch)
tree7cd85f7eda77b7fdfe55dd2e6e08b4f03b5ce915 /Modules
parent270a21fda0c41ea120727140ac966a86f694eee4 (diff)
downloadcpython-6165d55f1398ddf1cbd21e237129af7116a1fa73.zip
cpython-6165d55f1398ddf1cbd21e237129af7116a1fa73.tar.gz
cpython-6165d55f1398ddf1cbd21e237129af7116a1fa73.tar.bz2
Issue #28147: Fix a memory leak in split-table dictionaries
setattr() must not convert combined table into split table.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testcapimodule.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 29a28a7..060a92d 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -249,6 +249,15 @@ test_dict_iteration(PyObject* self)
}
+static PyObject*
+dict_hassplittable(PyObject *self, PyObject *arg)
+{
+ if (!PyArg_Parse(arg, "O!:dict_hassplittable", &PyDict_Type, &arg)) {
+ return NULL;
+ }
+ return PyBool_FromLong(_PyDict_HasSplitTable((PyDictObject*)arg));
+}
+
/* Issue #4701: Check that PyObject_Hash implicitly calls
* PyType_Ready if it hasn't already been called
*/
@@ -3858,6 +3867,7 @@ static PyMethodDef TestMethods[] = {
{"test_datetime_capi", test_datetime_capi, METH_NOARGS},
{"test_list_api", (PyCFunction)test_list_api, METH_NOARGS},
{"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS},
+ {"dict_hassplittable", dict_hassplittable, METH_O},
{"test_lazy_hash_inheritance", (PyCFunction)test_lazy_hash_inheritance,METH_NOARGS},
{"test_long_api", (PyCFunction)test_long_api, METH_NOARGS},
{"test_xincref_doesnt_leak",(PyCFunction)test_xincref_doesnt_leak, METH_NOARGS},