use errno attr instead of index into args for errno
If an OSError or IOError are instantiated without an errno value, e.g. e = OSError(). The existing code would give an IndexError: tuple index out of range. However there have been cases that the errno attribute wasn't populated so instead of switching to it this introduces a helper function to ensure we get the errno value through whatever means possible.
Fixed automatic port allocation in bind_sockets.
bind_sockets should use the same port on IPv4 and IPv6 if port=None.
Add tests and comments for how to disable this configuration. Make it slightly easier to disable by making the command line flag case-insensitive and allowing `None` instead of the string "none" when setting the flag in code. Closes #952.
This case is increasingly common now that coroutines are decoupled from stack contexts.
This speeds things up in comparison to the _iostream_return_future decorator by removing unnecessary abstraction and especially by allowing Futures to bypass some of the hoops IOStream jumps through to ensure a clean slate for its callbacks.
* Lazily initialize data structures for YieldPoints * Get rid of Runner.exc_info
Since it is no longer possible for TracebackFuture to modify concurrent.futures.Future instead, there is no need for separate classes. Removing the subclass speeds things up a bit by removing a level of indirection. Also microoptimized a few methods of Future.
The runner alone can catch all necessary exceptions as long as Futures are used; stack contexts are only needed for YieldPoints (especially Callback/Wait; Task could be changed to use a local-only stack context). This is slightly backwards incompatible for code that assumes the existence of a stack context without yielding anything.
The existing checks in StackContext.__exit__ are run after the damage has been done and may raise exceptions in the wrong place; gen.Runner is a more reliable place to detect this problem. Throwing the exception into the generator provides a better stack trace for the problem and also simplifies some of the complexity of testing for this feature.
…d of a callback. This allows for failures to be reported without relying on stack_context.
The shared implementation is nearly identical to the old gen.coroutine, with a small tweak for the callback argument.
This improves performance of applications using @coroutine and Futures, at the expense of some performance degradation for the older YieldPoint interfaces.
This improves performance and provides more consistent semantics (independent of the presence or absence of the concurrent.futures package). The parts of Tornado that accept Futures will accept both Tornado's thread-unsafe Futures and the thread-safe concurrent.futures.Future.
Fix a test that was not being run because of this issue.
is one of the accepted types: dict, bytes or unicode and raise a TypeError otherwise
This makes it easier to use IOStreams directly from coroutines. Closes #953.
…st". (This doesn't work on python 2.6)
Officially allow mixing of fds and file objects so that callers of add_accept_handler don't need to know about this change. As a side effect, fixes a problem with autoreload on windows. Closes #737.