aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c4
-rw-r--r--Python/sysmodule.c4
2 files changed, 3 insertions, 5 deletions
diff --git a/Python/import.c b/Python/import.c
index 12f586abc2e..f37393bbdc4 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -395,8 +395,8 @@ remove_module(PyThreadState *tstate, PyObject *name)
PyObject *modules = MODULES(tstate->interp);
if (PyDict_CheckExact(modules)) {
- PyObject *mod = _PyDict_Pop(modules, name, Py_None);
- Py_XDECREF(mod);
+ // Error is reported to the caller
+ (void)PyDict_Pop(modules, name, NULL);
}
else if (PyMapping_DelItem(modules, name) < 0) {
if (_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index e28523284f1..c17de44731b 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -125,11 +125,9 @@ sys_set_object(PyInterpreterState *interp, PyObject *key, PyObject *v)
}
PyObject *sd = interp->sysdict;
if (v == NULL) {
- v = _PyDict_Pop(sd, key, Py_None);
- if (v == NULL) {
+ if (PyDict_Pop(sd, key, NULL) < 0) {
return -1;
}
- Py_DECREF(v);
return 0;
}
else {