Changes before gevent 1.0#
Release 0.13.8 (September 6, 2012)#
Fixed issue #80: gevent.httplib failed with RequestFailed errors because timeout was reset to 1s. Patch by Tomasz Prus.
core: fix compilation with the latest Cython: remove emit_ifdef/emit_else/emit_endif.
Fixed issue #132: gevent.socket.gethostbyname(<unicode>) now does ascii encoding and uses gevent’s resolver rather than calling built-in resolver. Patch by Alexey Borzenkov.
Release 0.13.7 (April 12, 2012)#
Fixed issue #94: fallback to buffer if memoryview fails in _get_memory on python 2.7.
Fixed issue #103:
Falsenow (previously it returned
Fixed issue #112: threading._sleep is not patched. Thanks to David LaBissoniere.
Fixed issue #115: _dummy gets unexpected Timeout arg.
Release 0.13.6 (May 2, 2011)#
gevent.local.localclass that implements copy semantics compatible with built-in
threading.local. Patch by Galfy Pundee.
StreamServerclass to catch
EAGAIN. This fixes lots of spurious tracebacks on Windows where these two constants are not the same. Patch by Alexey Borzenkov.
Release 0.13.5 (Apr 21, 2011)#
Fixed build problem on Python 2.5
Release 0.13.4 (Apr 11, 2011)#
TypeErrorthat occurred when
environ["wsgi.input"].readfunction was called with an integer argument.
Fixed issue #67: Made
REQUEST_URIto environ. Patch by Andreas Blixt.
Fixed issue #71: monkey patching
gevent.httplibused to break
HTTPSConnection. Patch by Nick Barkas.
Fixed issue #74:
create_connectionnow raises proper exception when
BaseServer.server_portattributes to handle the case of
AF_UNIXaddresses properly. Previously they assumed address is always a tuple.
AF_UNIXlisteners. The server now sets
environ["SERVER_PORT"]to empty string in such case.
pywsgi.WSGIServer) accept up to 100 connections per one readiness notification. This behaviour is controlled by
If bind fails, the servers now include the address that caused bind to fail in the error message.
Release 0.13.3 (Feb 7, 2011)#
Fixed typo in
gevent.httplibthat rendered it unusable.
Removed unnecessary delay in
resolve_ipv6concurrently rather than sequentially in
Release 0.13.2 (Jan 28, 2011)#
gevent.httplib– experimental support for libevent-http client (issue #9). Thanks to Tommie Gannert, Örjan Persson.
Fixed crash on Mac OS X (issue #31). Patch by Alexey Borzenkov.
Fixed compatiblity of
gevent.wsgiwith libevent2 (issue #62).
Fixed compilation issues with libevent2. Patch by Ralf Schmitt.
pywsginot to use chunked transfer encoding in case of 304 and 204 responses as it creates a non-empty message body which is against RFC and causes some browsers to fail. Patch by Nicholas Piël.
socket.getaddrinfo()to handle international domain names.
Fixed leaking of traceback object when switching out of greenlet with
sys.exc_infoset. Leaking is prevented by not preserving traceback at all and only keeping the value of the exception. Thanks to Ned Rockson.
SSLSocketproperly, without raising
SSLError(read operation timeout).
Hubon Python 2.4.
Made a number of internal improvements to
gevent.pywsgito make subclassing easier.
WSGIServerto explicitly close the socket after the last request. Patch by Ralf Schmitt.
pywsgi.WSGIHandlernot to add
CONTENT_TYPEto the environ dict when there’s no
Content-Typeheader in the request. Previously a default
text/plainwas added in such case.
Added proper implementation of
Poolclass. Unlike previous “dummy” implementation this one starts yielding the results as soon as they are ready.
Implemented iterator protocol in
Queue. The main use case is the implementation of
BaseServer.startedproperty: it is now set to
kill. Previously it could become
Falsefor short period of times, because
StreamServercould stop accepting for a while in presence of errors and
StreamServer.startedwas defined as “whether the server is currently accepting”.
wsgi.WSGIServerto reply with 500 error immediately if the application raises an error (issue #58). Thanks to Jon Aslund.
monkey.patch_httplib()function which is disabled by default.
Added httplib parameter to
OverflowErrorthat could happen in
http_request.get_input_headers()return header names in lower case.
StreamServerto accept ciphers as an SSL argument.
build_exc --cython=option to
setup.py. Patch by Ralf Schmitt.
Release 0.13.1 (Sep 23, 2010)#
longarguments in addition to
JoinableQueue.join()to return immediately if queue is already empty (issue #45). Patch by Dmitry Chechik.
socket.shutdown()method to interrupt read/write operations on socket.
socket.connect_ex()method. Patch by Alexey Borzenkov.
Fixed socket leak in
Imported a number of patches from stdlib by Antoine Pitrou:
makefile()method on an SSL object would prevent the underlying socket from being closed until all objects get truly destroyed (Python issue #5238).
SSL handshake would ignore the socket timeout and block indefinitely if the other end didn’t respond (Python issue #5103).
SSLSocket.__init__, only silence exceptions caused by the “socket not connected” condition.
Added support for ciphers argument.
SSLSocket.recvmethods to match the behavior of stdlib
longvalues as pool argument in addition to
Updated webchat example to use file on disk rather than in-memory sqlite database to avoid
webproxy.pyexample to be runnable under external WSGI server.
Fixed bogus failure in
Added new test to check PEP8 conformance:
BackdoorServerclose the connection on
SystemExitand simplified the code.
ValueErrorwhen initialized with
setup.py --libeventto configure and make libevent if it’s not built already.
setuptoolsif present and add dependency on
Fixed doc/mysphinxext.py to work with Sphinx 1. Thanks by Örjan Persson.
Release 0.13.0 (Jul 14, 2010)#
StreamServerclass for easy implementing of TCP and SSL servers.
Fixed a number of bugs in
Fixed issue #26: closing a socket now interrupts all pending read/write operations on it.
Implemented workaround that prevents greenlets from leaking
socket.sendall()to use buffer object to prevent string copies.
Made the interfaces of
gevent.pywsgimuch more similar to each other.
Fixed compilation on Windows with libevent-2.
Improved Windows compatibility. Fixed issue #30. Thanks to Luigi Pugnetti.
Fixed compatibility with Python 2.7.
Blocking is now the default behaviour for the
Greenlet.kill()method and other kill* methods.
Changed the inteface of
http.HTTPServerto match the interface of other servers.
spawn()method to block until there’s a free slot.
Removed deprecated functions in
Deprecated use of negative numbers to indicate infinite timeout in
socket.wait_read()and similar. Use
Nonefrom now on, which is compatible with the previous versions.
core.http_connection. It is now used internally to detach the requests of the closed connections.
Group. The old name is currently available as an alias.
The module now uses
sys.platformto detect Windows rather than
Fixed issue #27:
getaddrinfo()used to handle the case when socktype or proto were equal to
0. Thanks to Randall Leeds.
BoundedSemaphoreclass to behave like
Event.wait()return internal flag instead of
ready()method as an alias for
Rewritten to use
serverand not to depend on
Changed the interface to match
Fixed compatibility with webob by allowing an optional argument to
Fixed reference leaks in
Avoid Python name lookups when accessing EV_* constants from Cython code. Patch by Daniele Varrazzo.
Added persist argument to
Made all of the event loop callbacks clear the exception info before exiting.
event. It is used by
Implemented iterator protocol.
detach()to detach input and output buffers too.
Changed the response to send 500 error upon deallocation, if no response was sent by the user.
output_bufferstore and reuse the
bufferobject they create.
__repr__to include spaces where needed.
httpclass no longer has
set_gencb(). Instead its contructor accepts handle which will be called on each request.
"Connection: close"header by default.
HTTPServernow derives from
baseserver.BaseServer. Thus its
start()method no longer accepts socket to listen on, it must be passed to the contructor.
The spawn argument now accepts a
Poolinstance. While the pool is full, the server replies with 503 error.
The server no longer links to the greenlets it spawns to detect errors. Instead, it relies on
http_requestwhich will send 500 reply when deallocated if the user hasn’t send any.
Put common server code in
gevent.baseservermodule. All servers in gevent package are now derived from
Remove the code related to finding out libevent version from setup.py as macro
USE_LIBEVENT_?is no longer needed to build
Increased default backlog in all servers (from 5 to 256). Thanks to Nicholas Piël.
Fixed doc/conf.py to work in Python older than 2.6. Thanks to Örjan Persson.
Silenced SystemError raised in
backdoorwhen a client typed
greenletfailed with ImportError, keep the original error message, because sometimes the error originates in setuptools.
select.select()to return all the file descriptors signalled, not just the first one.
thread(and thus monkey patched threads) to spawn
Greenletinstances, rather than raw greenlets.
Updated echoserver.py to use
Thanks to Ralf Schmitt for
pywsgi, a number of fixes for
wsgi, help with
server modules, improving setup.py and various other patches and suggestions.
Thanks to Uriel Katz for
Release 0.12.2 (Mar 2, 2010)#
Fixed http server to put the listening socket into a non-blocking mode. Contributed by Ralf Schmitt.
Release 0.12.1 (Feb 26, 2010)#
Removed a symlink from the distribution (that causes pip to fail). Thanks to Brad Clements for reporting it.
setup.py: automatically create symlink from
gevent.socket: Improved compatibility with stdlib’s socket:
Release 0.12.0 (Feb 5, 2010)#
Fixed Windows compatibility (experimental).
Improved performance of
socket.send()and similar methods.
Added a new module -
dns- with synchronous wrappers around libevent’s DNS API.
Fixed several incompatibilities of
wsgimodule with the WSGI spec.
env["REMOTE_PORT"]into a string.
Fixed the server to close the iterator returned by the application.
Made DNS functions no longer accept/return IP addresses in dots-and-numbers format. They work with packed IPs now.
Made DNS functions no longer accept additional arguments to pass to the callback.
Fixed DNS functions to check the return value of the libevent functions and raise
IOErrorif they failed.
Made core.event.cancel not to raise if event_del reports an error. instead, the return code is passed to the caller.
Fixed minor issue in string representation of the events.
Fixed bug in socket.accept. It could return unwrapped socket instance if socket’s timeout is 0.
Fixed socket.sendall implementation never to call underlying socket’s sendall.
getaddrinfo()to call the stdlib if the passed hostname has no dots.
getaddrinfo()to filter the results using socktype and proto arguments.
getnameinfo()as it didn’t quite match the stdlib interface. Use
dns.resolve_reverse()for reverse resolutions.
socket.connect_ex()to use cooperative
socket.dup()not to call underlying socket’s
dup()(which is not available on Windows) but to use Python’s reference counting similar to how the stdlib’s socket implements
Added _sock argument to
socket’s constructor. Passing the socket instance as first argument is no longer supported.
socket.sendall()to support flags argument.
socket.bind_and_listen(). The old name is still available as a deprecated alias.
The underlying socket object is now stored as
ssl(). (the old name is still available but deprecated)
GreenSocketalias for socket class.
Fixed Greenlet.spawn_link* and GreenletSet.spawn_link* classmethods not to assume anything about their arguments. (Thanks to Marcus Cavanaugh for pointing that out).
selectto clean up properly if event creation fails.
Fixed setup.py to proceed with compilation even if libevent version cannot be determined. 1.x.x is assumed in this case.
Fixed compatibility of .pyx files with Cython 0.12.0.
Renamed arguments for
select.select()to what they are called in the stdlib.
Removed internal function
libevent.h. They are not supported by vc90.
Removed some deprecated stuff from
Waiternow stores the value if no one’s waiting for it.
testrunner.pyscript that replaces a bunch of small scripts that were used before.
is_secureattribute from sockets and ssl objects.
Greenletnot to print a traceback when a not-yet-started greenlet is killed.
backdoor()function and deprecated
__getattr__from socket class.
Added aggressive argument to
Tests from stdlib no longer included in greentest package. Instead, there are number of stubs that import those tests from
testpackage directly and run them in monkey patched environment.
Added examples/process.py by Marcus Cavanaugh.
Release 0.11.2 (Dec 10, 2009)#
environ['PATH_INFO']before passing to application.
Fixed bug in
ValueErrorto be raised incorrectly here.
Release 0.11.1 (Nov 15, 2009)#
Fixed bug in
select.select()function. Passing non-empty list of write descriptors used to cause this function to fail.
Changed setup.py to go ahead with the compilation even if the actual version of libevent cannot be determined (version 1.x.x is assumed in that case).
Contributed by Ludvig Ericson:
start_responseto recognize exc_info argument.
Fixed setup.py to look for libevent.dylib rather than .so on Darwin platforms.
Release 0.11.0 (Oct 9, 2009)#
signal()to run the signal handler in a new greenlet; it was run in the
Queue.full()to be compatible with the standard
Queue. It tried to take into account the greenlets currently blocking on
putwhich was not useful and hard to reason about. Now it simply compares
qsizeto maxsize, which what the standard
Eventto behave exactly like the standard
Event.set()does not accept a parameter anymore; it’s now either set or not.
Event.getmethod is gone.
Event.set(); Event.clear()used to be a no-op; now it properly wakes up all the waiters.
AsyncResultbehaves exactly like before, but it does not inherit from
Eventanymore and does miss
GreenSocketis still available as an alias but will be removed in the future.
gevent.corenow includes wrappers for evbuffer, evdns, evhttp.
Renamed the old
Added a new HTTP server
gevent.httpmodule based on libevent-http wrappers.
Added a new WSGI server
gevent.wsgimodule based on
Added a few a few options to
setup.pyto select a libevent library to compile against. Check them out with
__all__to many modules that missed it.
Converted the docstrings and the changelog to sphinx/rst markup.
Added sphinx/rst documentation. It is available online at http://www.gevent.org.
Release 0.10.0 (Aug 26, 2009)#
TimeoutAPI in a backward-incompatible way:
Timeout.__init__()does not start the timer immediately anymore;
Timeout.start()must be called explicitly. A shortcut -
Timeout.start_new()- is provided that creates and starts a
The implementation of
Greenletis an improvement on
procmodule, with these bugs fixed:
Proc was not a subclass of greenlet which makes
getcurrent()useless and using Procs as keys in dict impossible.
Proc cannot be easily subclassed. To subclass
Greenlet, override its _run and __init__ methods.
gevent.eventmodule with 2 classes:
Eventis a drop-in replacement for
AsyncResultis an extension of
Eventthat supports exception passing via
gevent.pywsgi: pulled Mike Barton’s eventlet patches that fix double content-length issue.
setup.pyto search more places for system libevent installation. This fixes 64bit CentOS 5.3 installation issues, hopefully covers other platforms as well.
The following items were added to the gevent top level package:
The following items were marked as deprecated:
gevent.proc module (
wrap_errorshelper was moved to
gevent.coros.Queue and gevent.coros.Channel
gevent.greenlet was split into a number of modules:
gevent.rawgreenletcontains the old “polling” versions of
killall(they do not need
linkfunctionality and work with any greenlet by polling their status and sleeping in a loop)
Thanks to Jason Toffaletti for reporting the installation issue and providing a test case for WSGI double content-length header bug.
Release 0.9.3 (Aug 3, 2009)#
Timeoutto raise itself by default.
TimeoutErroris gone. Silent timeout is now created by passing
Fixed bug in
gevent.select.select()where it could silent the wrong timeout.
killall’s wait argument was renamed to block. The polling is now implemented by
greenlet.joinallfunctions and it become more responsive, with gradual increase of sleep time.
shutdown()function, which blocks until libevent has finished dispatching the events.
The return value of
event_delin core.pyx are now checked properly and
IOErroris raised if they have failed.
Fixed backdoor.py, accidentally broken in the previous release.
Release 0.9.2 (Jul 20, 2009)#
gevent.socket’s implementation and fixed SSL bug reported on eventletdev by Cesar Alaniz as well as failures in
core.active_eventclass that takes advantage of libevent’s
core.active_event(func)schedules func to be run in this event loop iteration as opposed to
core.timer(0, ...)which schedules an event to be run in the next iteration.
active_eventis now used throughout the library wherever
core.timer(0, ....)was previously used. This results in
spawn()being at least 20% faster compared to release 0.9.1 and twice as fast compared to eventlet. (The results are obtained with bench_spawn.py script in
Added boolean parameter wait to
killall()functions. If set to
True, it makes the function block until the greenlet(s) is actually dead. By default,
killall()are asynchronous, i.e. they don’t unschedule the current greenlet.
Added a few new properties to
flags. It also has
__exit__now, so it can be used as a context manager.
callbacksignature has changed from
(event, fd, evtype)to
Hub’s mainloop to never return successfully as this will screw up main greenlet’s
switch()call. Instead of returning it raises
reinit()function - wrapper for libevent’s
event_reinit. This function is a must have at least for daemons, as it fixes
epolland some others eventloops to work after
Trying to use gevent in another thread will now raise an exception immediately, since it’s not implemented.
Added a few more convenience methods
setup.pynot to depend on
Release 0.9.1 (Jul 9, 2009)#
Fixed compilation with libevent-1.3. Thanks to Litao Wei for reporting the problem.
Hubto recover silently after
event_dispatch()failures (I’ve seen this happen after
event_reinit()is called as necessary). The end result is that
fork()now works more reliably, as detected by
test_socketserver.py- it used to fail occasionally, now it does not.
Reorganized the package, most of the stuff from
gevent/__init__.pywas moved to
gevent/__init__.pyimports some of it back but not everything.
gevent.Timeout. The old name is available as an alias.
Fixed a few bugs in
queue.Queue. Added test_queue.py from standard tests to check how good is
queue.Queuea replacement for a standard
Queue(not good at all, timeouts in
queue.Queue.put()don’t work yet)
monkeynow patches ssl module when on 2.6 (very limited support).
Improved compatibility with Python 2.6 and Python 2.4.
Greenlet installed from PyPI (without py.magic prefix) is properly recognized now.
core.pyx was accidentally left out of the source package, it’s included now.
Release 0.9.0 (Jul 8, 2009)#
Started as eventlet 0.8.11 fork, with the intention to support only libevent as a backend. Compared to eventlet, this version has a much simpler API and implementation and a few severe bugs fixed, namely
Full duplex in sockets, i.e.
write()on the same fd do not cancel one another.
GreenSocket.closemethod does not hang as it could with eventlet.
There’s a test in my repo of eventlet that reproduces both of them: http://bitbucket.org/denis/eventlet/src/tip/greentest/test__socket.py
Besides having less bugs and less code to care about the goals of the fork are:
Piggy-back on libevent as much as possible (use its http and dns code).
Use the interfaces and conventions from the standard Python library where possible.