summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-05-09 04:25:18 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-05-09 04:25:18 (GMT)
commit65bcdd7195666e20eb56a7d49b5dd0ee2278e506 (patch)
tree409692635ac463a111176be3a8cf978a5d7165cd /Modules
parent07abcf58d98f2f2ae36a4cb20331b9e72b36ad4d (diff)
downloadcpython-65bcdd7195666e20eb56a7d49b5dd0ee2278e506.zip
cpython-65bcdd7195666e20eb56a7d49b5dd0ee2278e506.tar.gz
cpython-65bcdd7195666e20eb56a7d49b5dd0ee2278e506.tar.bz2
ensure .keywords is always a dict
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_functoolsmodule.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 57dfba0..24da677 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -54,17 +54,13 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
Py_DECREF(pto);
return NULL;
}
- if (kw != NULL) {
- pto->kw = PyDict_Copy(kw);
- if (pto->kw == NULL) {
- Py_DECREF(pto);
- return NULL;
- }
- } else {
- pto->kw = Py_None;
- Py_INCREF(Py_None);
+ pto->kw = (kw != NULL) ? PyDict_Copy(kw) : PyDict_New();
+ if (pto->kw == NULL) {
+ Py_DECREF(pto);
+ return NULL;
}
+
pto->weakreflist = NULL;
pto->dict = NULL;