All known bugs in the queue module were fixed and it is made 2.4-compatible.
LifoQueue and PriorityQueue are implemented as well.
gevent.queue.Queue implements the standard Queue interface with the only difference
that Queue(0) means queue of size 0 (i.e. a channel), not a queue of infinite size.
Having size of 0 means that put() method always blocks until the item is delivered.
gevent.queue will deprecate both coros.Queue and coros.Channel.
Timeout now raises itself by default. TimeoutError is gone.
This makes it easy to check that a timeout caught is actually the one raised:
timeout = Timeout(1)
except Timeout, t:
if timeout is not t:
raise # this is timeout set up by someone else and not us; we do not want to catch it
select() function had a bug of this kind that was fixed.
To instruct a with-block to silent the timeout one can pass False as a second
argument. In this case Timeout won't leave the with-block it belongs to (but
it can still be caught inside)
with Timeout(1, False):
print 'done reading'
Even if read() does not return within a second and will be interrupted with a
timeout, "done reading" will still be displayed.
spawn and spawn_later now avoid creating a closure and this decreases spawning
time by 50%.
kill and killall '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.
proc.RunningProcSet was renamed to proc.ProcSet.
shutdown() function was added, which can be used from the main greenlet to
wait until libevent has finished dispatching the events.
core.pyx now checks the return value of event_add and event_del and raises
IOError if they have failed.
backdoor.py, accidentally broken in the previous release, was fixed.
gevent.socket implementation was simplified and GreenSSL was almost completely
rewritten. This fixes SSL bug reported on eventletdev by Cesar Alaniz as well
as failures in test_socket_ssl.py from Python's standard library.
makeGreenFile is gone, makefile (which returns _fileobject) is available on
both GreenSocket and GreenSSL. socket.py still a work in progress.
New class core.active_event is added 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 0.9.1 and twice as fast compared to
eventlet. (The results are obtained with bench_spawn.py script in examples/ directory)
kill() and killall() methods now have boolean parameter "wait". 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.
core.event has got a few more properties: 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).
Hub's mainloop will never return successfully as this will screw up main greenlet's switch() call.
Instead of returning it raises DispatchExit.
reinit function (wrapper for libevent's event_reinit) is now available as gevent.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.
proc.RunningProcSet has a few more convenience methods spawn_link[exception/value].
setup.py has been fixed not to depend on setuptools.
gevent.timeout has been removed (use gevent.Timeout)
gevent can now be compiled with libevent-1.3 (Thanks to Litao Wei for reporting the problem.)
Hub now tries to silently recover after event_dispatch() failures (I've seen this happen
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.
The package was reorganized, 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.
gevent.timeout was renamed to gevent.Timeout.
Fixed a few bugs in queue.Queue.
Add test_queue.py from standard tests to check how good is gevent.queue.Queue a replacement
for a standard Queue (not good at all, timeouts in put() don't work yet)
monkey: 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.
Started as eventlet 0.8.11 spin-off, with 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: