Changelog

Version 0.12.2

  • Fixed http server to put the listening socket into a non-blocking mode. Contributed by Ralf Schmitt.

Version 0.12.1

  • Removed a symlink from the distribution (that causes pip to fail). Thanks to Brad Clements for reporting it.
  • setup.py: automatically create symlink from build/lib.../gevent/core.so to gevent/core.so.
  • gevent.socket: Improved compatibility with stdlib’s socket:
    • Fixed socket to raise timeout("timed out") rather than simply timeout.
    • Imported _GLOBAL_DEFAULT_TIMEOUT from standard socket module instead of creating a new object.

Version 0.12.0

  • Release highlights:
    • Added gevent.ssl module.
    • Fixed Windows compatibility (experimental).
    • Improved performance of socket.recv(), socket.send() and similar methods.
    • Added a new module - dns - with synchronous wrappers around libevent’s DNS API.
    • Added core.readwrite_event and socket.wait_readwrite() functions.
    • Fixed several incompatibilities of wsgi module with the WSGI spec.
    • Deprecated pywsgi module.
  • gevent.wsgi module
    • Made env["REMOTE_PORT"] into a string.
    • Fixed the server to close the iterator returned by the application.
    • Made wsgi.input object iterable.
  • gevent.core module
    • 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 IOError if they failed.
    • Added core.dns_err_to_string()
    • 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.
  • gevent.socket module
    • 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.
    • Fixed gethostbyname() and getaddrinfo() to call the stdlib if the passed hostname has no dots.
    • Fixed getaddrinfo() to filter the results using socktype and proto arguments.
    • Removed getnameinfo() as it didn’t quite match the stdlib interface. Use dns.resolve_reverse() for reverse resolutions.
    • Fixed socket.connect_ex() to use cooperative gethostbyname().
    • Fixed 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 dup()
    • Added _sock argument to socket‘s constructor. Passing the socket instance as first argument is no longer supported.
    • Fixed socket.connect() to ignore WSAEINVAL on Windows.
    • Fixed socket.connect() to use wait_readwrite() instead of wait_write().
    • Fixed socket.connect() to consult SO_ERROR.
    • Fixed socket.send() and socket.sendall() to support flags argument.
    • Renamed socket_bind_and_listen() to socket.bind_and_listen(). The old name is still available as a deprecated alias.
    • The underlying socket object is now stored as _sock property.
    • Imported the constants and some utility functions from stdlib’s socket into gevent.socket. (Thanks to Matt Goodall for the original patch).
    • Renamed wrap_ssl() to ssl(). (the old name is still available but deprecated)
    • Deprecated connect_tcp() and tcp_server().
    • Added sslerror to socket.__all__.
    • Removed GreenSocket alias for socket class.
    • Moved PyOpenSSL-based implementation of socket.ssl() into gevent.oldssl module. It’s imported into gevent.socket if importing gevent.ssl fails.
  • Miscellaneous
    • Fixed Greenlet.spawn_link* and GreenletSet.spawn_link* classmethods not to assume anything about their arguments. (Thanks to Marcus Cavanaugh for pointing that out).
    • Fixed select to clean up properly if event creation fails.
    • Fixed select to raise select.error instead of IOError.
    • 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 getLinkedCompleted() from gevent.greenlet
    • Remove #warning directives from libevent.h. They are not supported by vc90.
    • Removed some deprecated stuff from coros.
    • Internal class Waiter now stores the value if no one’s waiting for it.
    • Added testrunner.py script that replaces a bunch of small scripts that were used before.
    • Removed is_secure attribute from sockets and ssl objects.
    • Made Greenlet not to print a traceback when a not-yet-started greenlet is killed.
    • Added BackdoorServer class to backdoor module. Removed backdoor() function and deprecated backdoor_server() function.
    • Removed __getattr__ from socket class.
    • Fixed monkey.patch_socket() not to fail if socket.ssl() is not present in gevent.socket.
    • Added monkey.patch_ssl().
    • Added aggressive argument to monkey.patch_all().
    • Tests from stdlib no longer included in greentest package. Instead, there are number of stubs that import those tests from test package directly and run them in monkey patched environment.
    • Added examples/process.py by Marcus Cavanaugh.

Version 0.11.2

  • Fixed wsgi to unquote environ['PATH_INFO'] before passing to application.
  • Added SERVER_SOFTWARE variable to wsgi environ.
  • Fixed bug in JoinableQueue.task_done() that caused ValueError to be raised incorrectly here.
  • Fixed gevent.socket not to fail with ImportError if Python was not built with ssl support.

Version 0.11.1

  • 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:

  • Fixed wsgi‘s start_response to recognize exc_info argument.
  • Fixed setup.py to look for libevent.dylib rather than .so on Darwin platforms.

Version 0.11.0

  • Fixed timeout bug in joinall(), Greenlet.join(), pool.Pool.join(): if timeout has expired it used to raise Timeout; now it returns silently.
  • Fixed signal() to run the signal handler in a new greenlet; it was run in the Hub greenlet before.
  • Fixed Timeout.start_new(): if passed a Timeout instance, it now calls its start method before returning it.
  • Fixed gevent.monkey to patch threading.local properly.
  • Fixed Queue.empty() and Queue.full() to be compatible with the standard Queue. It tried to take into account the greenlets currently blocking on get/put which was not useful and hard to reason about. Now it simply compares qsize to maxsize, which what the standard Queue does too.
  • Fixed Event to behave exactly like the standard threading.Event:
    • Event.set() does not accept a parameter anymore; it’s now either set or not.
    • Event.get method is gone.
    • Event.set(); Event.clear() used to be a no-op; now it properly wakes up all the waiters.
    • AsyncResult behaves exactly like before, but it does not inherit from Event anymore and does miss clear() method.
  • Renamed internal helpers socket.wait_reader()/socket.wait_writer() to socket.wait_read()/socket.wait_write().
  • Renamed gevent.socket.GreenSocket to gevent.socket.socket. GreenSocket is still available as an alias but will be removed in the future.
  • gevent.core now includes wrappers for evbuffer, evdns, evhttp.
  • Renamed the old gevent.wsgi to gevent.pywsgi.
  • Added a new HTTP server gevent.http module based on libevent-http wrappers.
  • Added a new WSGI server gevent.wsgi module based on gevent.http.
  • Added evdns wrappers to gevent.core and DNS functions to gevent.socket module. Contributed by Jason Toffaletti..
  • Added a few a few options to setup.py to select a libevent library to compile against. Check them out with setup.py -h.
  • Added __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.

Version 0.10.0

  • Changed Timeout API 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 Timeout.

  • Added gevent.Greenlet class which is a subclass of greenlet that adds a few useful methods join/get/kill/link.

  • spawn() now returns Greenlet instance. The old spawn, which returns py.magic.greenlet instance, can be still accessed as spawn_raw().

    Note

    The implementation of Greenlet is an improvement on proc module, with these bugs fixed:

    • Proc was not a subclass of greenlet which makes getcurrent() useless and using Procs as keys in dict impossible.
    • Proc executes links sequentially, so one could block the rest from being executed. Greenlet executes each link in a new greenlet by default, unless it is set up with Greenlet.rawlink method.
    • Proc cannot be easily subclassed. To subclass Greenlet, override its _run and __init__ methods.
  • Added pool.Pool class with the methods compatible to the standard multiprocessing.pool: apply, map and others. It also has spawn method which is always async and returns a Greenlet instance.

  • Added gevent.event module with 2 classes: Event and AsyncResult. Event is a drop-in replacement for threading.Event, supporting set/wait/get methods. AsyncResult is an extension of Event that supports exception passing via set_exception method.

  • Added queue.JoinableQueue class with task_done and join methods.

  • Renamed core.read and core.write classes to core.read_event and core.write_event.

  • gevent.pywsgi: pulled Mike Barton’s eventlet patches that fix double content-length issue.

  • Fixed setup.py to 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_errors helper was moved to util module)
  • gevent.coros.event
  • gevent.coros.Queue and gevent.coros.Channel

Internally, gevent.greenlet was split into a number of modules:

Thanks to Jason Toffaletti for reporting the installation issue and providing a test case for WSGI double content-length header bug.

Version 0.9.3

  • Fixed all known bugs in the gevent.queue module and made it 2.4-compatible. LifoQueue and PriorityQueue are implemented as well. gevent.queue will deprecate both coros.Queue and coros.Channel.
  • Fixed Timeout to raise itself by default. TimeoutError is gone. Silent timeout is now created by passing False instead of None.
  • Fixed bug in gevent.select.select() where it could silent the wrong timeout.
  • spawn() and spawn_later() now avoid creating a closure and this decreases spawning time by 50%.
  • kill‘s and killall‘s wait argument was renamed to block. The polling is now implemented by greenlet.join and greenlet.joinall functions and it become more responsive, with gradual increase of sleep time.
  • Renamed proc.RunningProcSet to proc.ProcSet.
  • Added shutdown() function, which blocks until libevent has finished dispatching the events.
  • The return value of event_add and event_del in core.pyx are now checked properly and IOError is raised if they have failed.
  • Fixed backdoor.py, accidentally broken in the previous release.

Version 0.9.2

  • Simplified gevent.socket‘s implementation and fixed SSL bug reported on eventletdev by Cesar Alaniz as well as failures in test_socket_ssl.py.
  • Removed GreenSocket.makeGreenFile; Use socket.socket.makefile() that returns _fileobject and is available on both GreenSocket and GreenSSL. socket.py still a work in progress.
  • Added new core.active_event class that takes advantage of libevent’s event_active function. 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_event is now used throughout the library wherever core.timer(0, ....) was previously used. This results in spawn() being at least 20% faster compared to Version 0.9.1 and twice as fast compared to eventlet. (The results are obtained with bench_spawn.py script in greentest/ directory)
  • Added boolean parameter wait to kill() and killall() functions. If set to True, it makes the function block until the greenlet(s) is actually dead. By default, kill() and killall() are asynchronous, i.e. they don’t unschedule the current greenlet.
  • Added a few new properties to gevent.core.event: fd, events, events_str and flags. It also has __enter__ and __exit__ now, so it can be used as a context manager. event‘s callback signature has changed from (event, fd, evtype) to (event, evtype).
  • Fixed Hub‘s mainloop to never return successfully as this will screw up main greenlet’s switch() call. Instead of returning it raises DispatchExit.
  • Added reinit() function - wrapper for libevent’s event_reinit. This function is a must have at least for daemons, as it fixes epoll and some others eventloops to work after fork.
  • Trying to use gevent in another thread will now raise an exception immediately, since it’s not implemented.
  • Added a few more convenience methods spawn_link[exception/value] to proc.RunningProcSet.
  • Fixed setup.py not to depend on setuptools.
  • Removed gevent.timeout (use gevent.Timeout)

Version 0.9.1

  • Fixed compilation with libevent-1.3 (Thanks to Litao Wei for reporting the problem.)
  • Fixed Hub to recover silently after event_dispatch() failures (I’ve seen this happen after fork even though 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__.py was moved to gevent/greenlet.py. gevent/__init__.py imports some of it back but not everything.
  • Renamed gevent.timeout to 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.Queue a replacement for a standard Queue (not good at all, timeouts in queue.Queue.put() don’t work yet)
  • monkey now 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.
  • GreenSocket now wraps a socket object from _socket module rather than from socket.

Version 0.9.0

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. read() and write() on the same fd do not cancel one another
  • GreenSocket.close 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