summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 970530f..34915de 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -844,12 +844,7 @@ _locale_exec(PyObject *module)
_locale_state *state = get_locale_state(module);
state->Error = PyErr_NewException("locale.Error", NULL, NULL);
- if (state->Error == NULL) {
- return -1;
- }
- Py_INCREF(get_locale_state(module)->Error);
- if (PyModule_AddObject(module, "Error", get_locale_state(module)->Error) < 0) {
- Py_DECREF(get_locale_state(module)->Error);
+ if (PyModule_AddObjectRef(module, "Error", state->Error) < 0) {
return -1;
}