summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index f3b64fe..51192bd 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -798,8 +798,7 @@ pycore_init_builtins(PyThreadState *tstate)
if (builtins_dict == NULL) {
goto error;
}
- Py_INCREF(builtins_dict);
- interp->builtins = builtins_dict;
+ interp->builtins = Py_NewRef(builtins_dict);
PyObject *isinstance = PyDict_GetItem(builtins_dict, &_Py_ID(isinstance));
assert(isinstance);
@@ -2289,8 +2288,7 @@ create_stdio(const PyConfig *config, PyObject* io,
goto error;
}
else {
- raw = buf;
- Py_INCREF(raw);
+ raw = Py_NewRef(buf);
}
#ifdef MS_WINDOWS
@@ -2552,8 +2550,7 @@ _Py_FatalError_PrintExc(PyThreadState *tstate)
_PyErr_NormalizeException(tstate, &exception, &v, &tb);
if (tb == NULL) {
- tb = Py_None;
- Py_INCREF(tb);
+ tb = Py_NewRef(Py_None);
}
PyException_SetTraceback(v, tb);
if (exception == NULL) {