What’s new in gevent 1.0#
- Changes for 1.0
- Release 1.0.2
- Release 1.0.1
- Release 1.0 (Nov 26, 2013)
- Release 1.0rc3 (Sep 14, 2013)
- Release 1.0rc2 (Dec 10, 2012)
- Release 1.0rc1 (Oct 30, 2012)
- Release 1.0b4 (Sep 6, 2012)
- Release 1.0b3 (Jul 27, 2012)
- Release 1.0b2 (Apr 11, 2012)
- Release 1.0b1 (Jan 10, 2012)
- Release 1.0a3 (Sep 15, 2011)
- Release 1.0a2 (Aug 2, 2011)
- Release 1.0a1 (Aug 2, 2011)
The detailed information is available in Changes for 1.0. Below is the summary of all changes since 0.13.8.
Gevent 1.0 supports Python 2.5 - 2.7. The version of greenlet required is 0.3.2. The source distribution now includes the dependencies (libev and c-ares) and has no dependencies other than greenlet.
Now the event loop is using libev instead of libevent (see http://blog.gevent.org/2011/04/28/libev-and-libevent/ for motivation).
The signal handlers set with the standard signal module are no longer blocked by the event loop.
The event loops are now pluggable. The GEVENT_LOOP environment variable can specify the alternative class to use (the default is
The error handling is now done by Hub.handle_error().
The system errors that usually kill the process (SystemError, SystemExit, KeyboardInterrupt) are now re-raised in the main greenlet.
sys.exit() when run inside a greenlet is no longer trapped and kills the process as expected.
New dns resolver#
Two new DNS resolvers: threadpool-based one (enabled by default) and c-ares based one. That threadpool-based resolver was added mostly for Windows and Mac OS X platforms where c-ares might behave differently w.r.t system configuration. On Linux, however, the c-ares based resolver is probably a better choice. To enable c-ares resolver set GEVENT_RESOLVER=ares environment variable.
This fixes some major issues with DNS on 0.13.x, namely:
Issue #2: DNS resolver no longer breaks after
fork(). You still need to call
os.forkis monkey patched with it if
DNS resolver no longer ignores
The following functions were added to socket module:
It is possible to implement your own DNS resolver and make gevent use it. The GEVENT_RESOLVER variable can point to alternative implementation using the format:
package.module.class. The default is
gevent.resolver_thread.Resolver. The alternative “ares” resolver is an alias for
UDP server: gevent.server.DatagramServer
gevent.subprocessimplements the interface of the standard subprocess module in a cooperative way. It is possible to monkey patch the standard subprocess module with
patch_all(subprocess=True)(not done by default).
Warning: this feature is experimental and should be used with care.
gevent.threadpoolmodule provides the usual pool methods (apply, map, imap, etc) but runs passed functions in a real OS thread.
There’s a default threadpool, available as
gevent.dns module (wrapper around libevent-dns)
gevent.http module (wrapper around libevent-http)
deprecated gevent.sslold module
deprecated gevent.rawgreenlet module
GreenletSetwhich used to be alias for
link to greenlet feature of Greenlet
undocumented bind_and_listen and tcp_listener
Renamed gevent.coros to gevent.lock. The gevent.coros is still available but deprecated.
In all servers, method “kill” was renamed to “close”. The old name is available as deprecated alias.
Queue(0)is now equivalent to an unbound queue and raises
gevent.queue.Channelif you need a channel.
Issue #302: “python -m gevent.monkey” now sets __file__ properly.
Issue #143: greenlet links are now executed in the order they were added
Fixed monkey.patch_thread() to patch threading._DummyThread to avoid leak in threading._active.
gevent.thread: allocate_lock is now an alias for LockType/Semaphore. That way it does not fail when being used as class member.
It is now possible to add raw greenlets to the pool.
imap()methods now start yielding the results as soon as possible.
imap_unordered()no longer swallows an exception raised while iterating its argument.
gevent.sleep(<negative value>)no longer raises an exception, instead it does
max_acceptto 1 if
wsgi.multiprocessingis set to
monkey.patch_module()function that monkey patches module using
__implements__list provided by gevent module. All of gevent modules that replace stdlib module now have
Fix logging when bound on unix socket (#295).
readout request data to prevent ECONNRESET
Fix #79: Properly handle HTTP versions.
Fix #86: bytearray is now supported.
Fix #92: raise IOError on truncated POST requests.
Fix #93: do not sent multiple “100 continue” responses
Fix #116: Multiline HTTP headers are now handled properly.
Fix #216: propagate errors raised by Pool.map/imap
Fix #303: ‘requestline’ AttributeError in pywsgi.
Raise an AssertionError if non-zero content-length is passed to start_response(204/304) or if non-empty body is attempted to be written for 304/204 response
Made sure format_request() does not fail if ‘status’ attribute is not set yet
Added REMOTE_PORT variable to the environment.
Removed unused deprecated ‘wfile’ property from WSGIHandler