Set version number in branch4.0 to 4.0.2.dev1
Fix a regression in which a timeout could fire after being cancelled.

Closes #1148.
Fixed support for test generators

This fixes the problem that AsyncTestCase no longer seemed to work with test generators (as supported by Nose, http://nose.readthedocs.org/en/latest/writing_tests.html#test-generators).
Fix a regression in gzip output for StaticFileHandler.

Streaming static responses confused the gzip output transform since
it could no longer set the correct outgoing content-length.  Now
it will fall back to chunked encoding in this case.

Closes #1156.
Add missing argument max_buffer_size to TCPClient.connect in SimpleAsyncHTTPClient
Fix a subtle reference cycle that can lead to increased memory consumption.

Closes #1165.
Limit the number of connections we will accept per call to accept_handler.

This ensures that other callbacks scheduled on the IOLoop have a chance
to run.  This shows up as increased memory usage in benchmark scenarios
(since 4.0 allowed simple http transactions to be processed synchronously).
Fix an erroneous return of None in IOStream.connect.

This causes AttributeErrors in TCPClient, although I can only
reproduce this case reliably on freebsd.

Closes #1168.
Add release notes for 4.0.2.
Add documentation warning about exceptions in coroutines
Set version number to 4.0.2
Add callback error handling to Future

Catches and logs to the application log exceptions raised by each callback. This
more or less mirrors what concurrent.futures.Future does.
Added a unit test for setting a cookie with expires_days
Merge pull request #1185 from leekchan/master

Added unit tests for tornado.web.removeslash and tornado.web.addslash
Merge branch 'branch4.0'

Conflicts:
	docs/releases.rst
	setup.py
	tornado/__init__.py
Capture stack context in gen.engine's wrapper function.

This was an error that went unnoticed in earlier versions
because Futures passed through exceptions in their callbacks.
Merge commit 'f40d39b'
Merge pull request #1175 from virtuald/coroutine-warning

Add documentation warning about exceptions in coroutines
Handle multiple exceptions in AsyncTestCase.

Previously we would silently swallow all but the last; now we
raise the first and log all the rest.

Closes #1177.
Update example for HTTPClient exception handling.

Eliminate the implication that HTTPError is the only
error that can be raised.  See #1168.