diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 18:28:20 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 18:28:20 (GMT) |
commit | f38a5c28e0f032e6eb9bab7c178f43f0bd2cad8d (patch) | |
tree | 2f351c8fc82d6d7ecdbe43b827ba5662498b7a78 | |
parent | 1ce3f840be7823f6a898c31de19b200874a1b8a8 (diff) | |
download | cpython-f38a5c28e0f032e6eb9bab7c178f43f0bd2cad8d.zip cpython-f38a5c28e0f032e6eb9bab7c178f43f0bd2cad8d.tar.gz cpython-f38a5c28e0f032e6eb9bab7c178f43f0bd2cad8d.tar.bz2 |
Cleanup locale.localeconv(): move Py_DECREF() closer to the error
-rw-r--r-- | Modules/_localemodule.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index b196749..400c344 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -151,8 +151,10 @@ PyLocale_localeconv(PyObject* self) do { \ if (obj == NULL) \ goto failed; \ - if (PyDict_SetItemString(result, key, obj) < 0) \ + if (PyDict_SetItemString(result, key, obj) < 0) { \ + Py_DECREF(obj); \ goto failed; \ + } \ Py_DECREF(obj); \ } while (0) @@ -196,7 +198,6 @@ PyLocale_localeconv(PyObject* self) failed: Py_XDECREF(result); - Py_XDECREF(x); return NULL; } |