diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-05-09 04:23:41 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-05-09 04:23:41 (GMT) |
commit | 72c0141f03f723fe5269cb9cdcb1541a4c6811e8 (patch) | |
tree | 45e30a07f651a09a4aefdbd1e5db8488f29a1f98 /Modules/_functoolsmodule.c | |
parent | 36691efe7b00776f4c14247a1a161a1d9ed6b600 (diff) | |
download | cpython-72c0141f03f723fe5269cb9cdcb1541a4c6811e8.zip cpython-72c0141f03f723fe5269cb9cdcb1541a4c6811e8.tar.gz cpython-72c0141f03f723fe5269cb9cdcb1541a4c6811e8.tar.bz2 |
ensure .keywords is always a dict
Diffstat (limited to 'Modules/_functoolsmodule.c')
-rw-r--r-- | Modules/_functoolsmodule.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 6397ba9..2ba92ba 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -132,17 +132,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; |