summaryrefslogtreecommitdiffstats
path: root/Objects/funcobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r--Objects/funcobject.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 80117bf..d60e4eb 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -47,9 +47,8 @@ PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname
PyCodeObject *code_obj = (PyCodeObject *)Py_NewRef(code);
- PyObject *name = code_obj->co_name;
- assert(name != NULL);
- Py_INCREF(name);
+ assert(code_obj->co_name != NULL);
+ PyObject *name = Py_NewRef(code_obj->co_name);
if (!qualname) {
qualname = code_obj->co_qualname;
@@ -525,10 +524,7 @@ func_get_annotations(PyFunctionObject *op, void *Py_UNUSED(ignored))
return NULL;
}
PyObject *d = func_get_annotation_dict(op);
- if (d) {
- Py_INCREF(d);
- }
- return d;
+ return Py_XNewRef(d);
}
static int