zeromq/pyzmq — pull request #564 by cmd-ntrf (2014-07-03 19:50:07+00:00)
Title: Add TypeError handling to _check_rc function.

I have experimented some problems at the end of a process that uses pyzmq with Python 3.4.0 (and Python 3.4.1 as well). The following Exception is raised on some occasions.
```
Exception ignored in: >
Traceback (most recent call last):
File "[...]/site-packages/zmq/sugar/socket.py", line 52, in __del__
File "socket.pyx", line 277, in zmq.backend.cython.socket.Socket.close (zmq/backend/cython/socket.c:2985)
File "checkrc.pxd", line 21, in zmq.backend.cython.checkrc._check_rc (zmq/backend/cython/socket.c:6007)
TypeError: 'NoneType' object is not callable
```

This exception is raised because the importation of zmq.error classes is impossible. This is yet fully known why it happens, but it is probably related to the garbage collector. This patch avoids TypeError by catching them if they happen during the importation, and simply returns 0 since this means that the process has ended anyway.

The other solution would be to import the exception at the beginning of the module, and check ```if ZMQError is not None``` before raising it.