Skip to content

Commit 93f84ad

Browse files
committed
Enhance tests
1 parent 4f2de54 commit 93f84ad

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Modules/_testcapi/dict.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,13 @@ dict_pop(PyObject *self, PyObject *args)
347347
assert(result == NULL);
348348
return NULL;
349349
}
350-
if (result == NULL) {
350+
if (res == 0) {
351+
assert(result == NULL);
351352
result = Py_NewRef(Py_None);
352353
}
354+
else {
355+
assert(result != NULL);
356+
}
353357
return Py_BuildValue("iN", res, result);
354358
}
355359

@@ -388,9 +392,13 @@ dict_popstring(PyObject *self, PyObject *args)
388392
assert(result == NULL);
389393
return NULL;
390394
}
391-
if (result == NULL) {
395+
if (res == 0) {
396+
assert(result == NULL);
392397
result = Py_NewRef(Py_None);
393398
}
399+
else {
400+
assert(result != NULL);
401+
}
394402
return Py_BuildValue("iN", res, result);
395403
}
396404

0 commit comments

Comments
 (0)