summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 70872222eb..35292b6478 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -718,8 +718,7 @@ _Py_HandleSystemExit(int *exitcode_p)
/* The error code should be in the `code' attribute. */
PyObject *code = PyObject_GetAttr(value, &_Py_ID(code));
if (code) {
- Py_DECREF(value);
- value = code;
+ Py_SETREF(value, code);
if (value == Py_None)
goto done;
}