summaryrefslogtreecommitdiffstats
path: root/Objects/funcobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r--Objects/funcobject.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 51b6c9d..da54069 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -116,8 +116,7 @@ PyFunction_SetDefaults(PyObject *op, PyObject *defaults)
PyErr_SetString(PyExc_SystemError, "non-tuple default args");
return -1;
}
- Py_XDECREF(((PyFunctionObject *) op) -> func_defaults);
- ((PyFunctionObject *) op) -> func_defaults = defaults;
+ Py_SETREF(((PyFunctionObject *)op)->func_defaults, defaults);
return 0;
}
@@ -149,8 +148,7 @@ PyFunction_SetClosure(PyObject *op, PyObject *closure)
closure->ob_type->tp_name);
return -1;
}
- Py_XDECREF(((PyFunctionObject *) op) -> func_closure);
- ((PyFunctionObject *) op) -> func_closure = closure;
+ Py_SETREF(((PyFunctionObject *)op)->func_closure, closure);
return 0;
}
@@ -430,8 +428,7 @@ func_new(PyTypeObject* type, PyObject* args, PyObject* kw)
if (name != Py_None) {
Py_INCREF(name);
- Py_DECREF(newfunc->func_name);
- newfunc->func_name = name;
+ Py_SETREF(newfunc->func_name, name);
}
if (defaults != Py_None) {
Py_INCREF(defaults);