summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-09-08 13:09:49 (GMT)
committerGitHub <noreply@github.com>2023-09-08 13:09:49 (GMT)
commite65401d24512503f50baab1543928102def53b5a (patch)
tree4f3dfec44cd248af9e6a0748bb1cce3fbc104a9f /Modules/_testcapimodule.c
parentdb55cfcbabfe257f5d3aeaffc1c5fe0166030c03 (diff)
downloadcpython-e65401d24512503f50baab1543928102def53b5a.zip
cpython-e65401d24512503f50baab1543928102def53b5a.tar.gz
cpython-e65401d24512503f50baab1543928102def53b5a.tar.bz2
[3.12] C API tests: use special markers to test that output parameters were set (GH-109014) (#109023)
[3.12] C API tests: use special markers to test that output parameters were set (GH-109014). (cherry picked from commit bf414b7fcb7c8ba780a5e1d9f320ecef0c7f9488)
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index dec64af..4904e8a 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -221,10 +221,13 @@ test_dict_inner(int count)
Py_DECREF(v);
}
+ k = v = UNINITIALIZED_PTR;
while (PyDict_Next(dict, &pos, &k, &v)) {
PyObject *o;
iterations++;
+ assert(k != UNINITIALIZED_PTR);
+ assert(v != UNINITIALIZED_PTR);
i = PyLong_AS_LONG(v) + 1;
o = PyLong_FromLong(i);
if (o == NULL)
@@ -234,7 +237,10 @@ test_dict_inner(int count)
return -1;
}
Py_DECREF(o);
+ k = v = UNINITIALIZED_PTR;
}
+ assert(k == UNINITIALIZED_PTR);
+ assert(v == UNINITIALIZED_PTR);
Py_DECREF(dict);