zeromq/pyzmq — pull request #265 by dowski (2012-10-03 21:23:50+00:00)
Title: Fix for an Exception raised when processes exit.

Depending on how an application imports modules, if the reference counts
can lead to `zmq.core.context` getting garbage collected upon process
termination *before* the `Context.__dealloc__` method is called.

The problem is that `__dealloc__` calls `getpid` which was imported by
`zmq.core.context`. At least, it tries to call it, but since the module
was GC'ed, is is `None` and you get the following exception.

Exception TypeError: "'NoneType' object is not callable" in ignored

This change bails out of the typical `term()` function that is called on
`__dealloc__` if `getpid is None`.