summaryrefslogtreecommitdiff
path: root/c/cffi1_module.c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2015-12-06 19:32:36 +0100
committerArmin Rigo <arigo@tunes.org>2015-12-06 19:32:36 +0100
commit0aa5d4ad5cfb9c4ebe1f0b9491e83c2887c9f90a (patch)
treec41139888cfcf0ac8c9dfe6efb83b1dd4f7b7e95 /c/cffi1_module.c
parent25eb2fe22a96dcbbc0bfcc59ada316788f091898 (diff)
downloadcffi-0aa5d4ad5cfb9c4ebe1f0b9491e83c2887c9f90a.tar.gz
fix for a case that never occurs
Diffstat (limited to 'c/cffi1_module.c')
-rw-r--r--c/cffi1_module.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/c/cffi1_module.c b/c/cffi1_module.c
index b8668b7..a23ae67 100644
--- a/c/cffi1_module.c
+++ b/c/cffi1_module.c
@@ -21,7 +21,7 @@ static PyTypeObject Lib_Type; /* forward */
static int init_ffi_lib(PyObject *m)
{
PyObject *x;
- int i;
+ int i, res;
static char init_done = 0;
if (PyType_Ready(&FFI_Type) < 0)
@@ -47,11 +47,13 @@ static int init_ffi_lib(PyObject *m)
for (i = 0; all_dlopen_flags[i].name != NULL; i++) {
x = PyInt_FromLong(all_dlopen_flags[i].value);
- if (x == NULL || PyDict_SetItemString(FFI_Type.tp_dict,
- all_dlopen_flags[i].name,
- x) < 0)
+ if (x == NULL)
return -1;
+ res = PyDict_SetItemString(FFI_Type.tp_dict,
+ all_dlopen_flags[i].name, x);
Py_DECREF(x);
+ if (res < 0)
+ return -1;
}
init_done = 1;
}