The detailed information is available in changelog. 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 new gevent.core
has been rewritten to wrap libev’s API. (On Windows, the gevent.core
accepts Windows handles
rather than stdio file descriptors.).
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 enviroment variable can specify the alternative class to use (the default is gevent.core.loop
).
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.
Thus sys.exit()
when run inside a greenlet is no longer trapped and kills the process as expected.
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:
fork()
. You still need to call gevent.fork()
(os.fork
is monkey patched with it if monkey.patch_all()
was called)./etc/resolv.conf
and /etc/hosts
.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 gevent.resolver_ares.Resolver
.
UDP server: gevent.server.DatagramServer
Subprocess support
New gevent.subprocess
implements 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).
Thread pool
Warning: this feature is experimental and should be used with care.
The gevent.threadpool
module 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.get_hub().threadpool
.
util.lazy_property
property.GreenletSet
which used to be alias for Group
.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 DeprecationError
. Use gevent.queue.Channel
if you need a channel.The gevent.Greenlet
objects:
__nonzero__
implementation that returns True after greenlet was started until it’s dead. This overrides
greenlet’s __nonzero__ which returned False after start() until it was first switched to.map()
and imap()
methods now start yielding the results as soon as possible.imap_unordered()
no longer swallows an exception raised while iterating its argument.WSGIServer
now sets max_accept to 1 if wsgi.multiprocessing is set to True.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 __implements__ attribute.pywsgi:
Next page: Changelog