diff options
author | Choi Geonu <6566gun@gmail.com> | 2017-10-24 11:39:12 +0900 |
---|---|---|
committer | Choi Geonu <6566gun@gmail.com> | 2017-10-24 11:39:12 +0900 |
commit | 3ec5ded981c5e404a0a2a6ad53bf4db36f28da94 (patch) | |
tree | b5a9358213ffe80a1b3c67c250d4ba539c340aca | |
parent | 4d82d69961855ecea2e09f020f0a842b03baddbf (diff) | |
download | librabbitmq-3ec5ded981c5e404a0a2a6ad53bf4db36f28da94.tar.gz |
Return NULLs explicitly in the module initialization
-rw-r--r-- | Modules/_librabbitmq/connection.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Modules/_librabbitmq/connection.c b/Modules/_librabbitmq/connection.c index b3979eb..bcf85fe 100644 --- a/Modules/_librabbitmq/connection.c +++ b/Modules/_librabbitmq/connection.c @@ -2264,7 +2264,11 @@ PYRABBITMQ_MOD_INIT(_librabbitmq) PyObject *module, *socket_module; if (PyType_Ready(&PyRabbitMQ_ConnectionType) < 0) { + #if PY_MAJOR_VERSION >= 3 + return NULL; + #else return; + #endif } #if PY_MAJOR_VERSION >= 3 @@ -2275,13 +2279,22 @@ PYRABBITMQ_MOD_INIT(_librabbitmq) #endif if (module == NULL) { + #if PY_MAJOR_VERSION >= 3 + return NULL; + #else return; + #endif } /* Get socket.error */ socket_module = PyImport_ImportModule("socket"); - if (!socket_module) + if (!socket_module) { + #if PY_MAJOR_VERSION >= 3 + return NULL; + #else return; + #endif + } PyRabbitMQ_socket_timeout = PyObject_GetAttrString(socket_module, "timeout"); Py_XDECREF(socket_module); |