SiteSupport/gevent — pull request #235 by jgehrcke (2013-01-27 15:42:57+00:00)
Title: Fix Hub.destroy(): replace self._threadpool.close() with self._threadpool.kill()

Hello,

[Ken Chatfield](http://www.robots.ox.ac.uk/~ken/) found a bug in `gevent/hub.py` when using gevent's WSGIServer together with [gipc](http://pypi.python.org/pypi/gipc). I have created a repro:

import gevent
h = gevent.get_hub()
tp = h.threadpool
h.destroy()

resulting in

Traceback (most recent call last):
File "repro.py", line 5, in
h.destroy()
File "gevent/hub.py", line 408, in destroy
self._threadpool.close()
AttributeError: 'ThreadPool' object has no attribute 'close'

I grepped through gevent's repo and it looks like `Hub.destroy()` is the only place in gevent where `ThreadPool.close()` is erroneously called.

In this pull request, I have

- replaced `self._threadpool.close()` in `Hub.destroy()` with `self._threadpool.kill()`. Looks like this is the first time `ThreadPool.kill()` is applied. This change does not have a negative impact on current gevent unit tests.
- added a new unit test for the repro above.