NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #597 most downloaded on PyPI
Coroutine-based network library
Last release 13 days ago
16 Sep 2026
Release timing varies
gaps range from 8 days to 7 months
Most releases are documented
notes for 46 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
17 years old
99 releases · first in 2009
Nothing published for this version
Nothing published for this version
Python 2: sendall on a non-blocking socket could spuriously fail with a timeout.
Python 2: sendall on a non-blocking socket could spuriously fail with a timeout.
If sys.stderr has been monkey-patched (not recommended), exceptions that the hub reports aren't lost and can still be caught. Reported in 825 by Jelle Smet.
selectors.SelectSelector is properly monkey-patched regardless of the order of imports. Reported in 835 by Przemysław Węgrzyn.
Python 2: reload(site) no longer fails with a TypeError if gevent has been imported. Reported in 805 by Jake Hilton.
One column per quarter.
Nested callbacks that set and clear an Event no longer cause wait to return prematurely. Reported in 771 by Sergey Vasilyev.
# 1.1.1 (Apr 4, 2016) - Nested callbacks that set and clear an Event no longer cause
wait to return prematurely. Reported in 771 by Sergey Vasilyev.
Fix build on Solaris 10. Reported in 777 by wiggin15.
The ref parameter to gevent.os.fork_and_watch was being ignored.
Python 3: gevent.queue.Channel is now correctly iterable, instead of raising a TypeError.
Python 3: Add support for socket.socket.sendmsg, socket.socket.recvmsg and socket.socket.recvmsg_into on platforms where they are defined. Initial 773 by Jakub Klama.
Python 3: A monkey-patched threading.RLock now properly blocks (or deadlocks) in acquire if the default value for _timeout_ of -1 is used (which diffe
Python 3: A monkey-patched threading.RLock now properly blocks (or deadlocks) in acquire if the default value for _timeout_ of -1 is used (which differs from gevent's default of None). The acquire method also raises the same ValueError exceptions that the standard library does for invalid parameters. Reported in #750 by Joy Zheng.
Fix a race condition in ~gevent.event.Event that made it return False when the event was set and cleared by the same greenlet before allowing a switch to already waiting greenlets. (Found by the 3.4 and 3.5 standard library test suites; the same as Python `bug 13502`_. Note that the Python 2 standard library still has this race condition.)
~gevent.event.Event and ~.AsyncResult now wake waiting greenlets in the same (unspecified) order. Previously, AsyncResult tended to use a FIFO order, but this was never guaranteed. Both classes also use less per-instance memory.
Using a ~logging.Logger as a pywsgi error or request log stream no longer produces extra newlines. Reported in #756 by ael-code.
Windows: Installing from an sdist (.tar.gz) on PyPI no longer requires having Cython installed first. (Note that the binary installation formats (wheels, exes, msis) are preferred on Windows.) Reported in #757 by Ned Batchelder.
Issue a warning when ~gevent.monkey.patch_all is called with os set to False (_not_ the default) but signal is still True (the default). This combination of parameters will cause signal handlers for SIGCHLD to not get called. In the future this might raise an error. Reported by Josh Zuech.
Issue a warning when ~gevent.monkey.patch_all is called more than once with different arguments. That causes the cumulative set of all True arguments to be patched, which may cause unexpected results.
Fix returning the original values of certain threading attributes from gevent.monkey.get_original.
SSL: Attempting to send empty data using the ~socket.socket.sendall method of a gevent SSL socket that has a timeout now returns immediately (like the
SSL: Attempting to send empty data using the ~socket.socket.sendall method of a gevent SSL socket that has a timeout now returns immediately (like the standard library does), instead of incorrectly raising ssl.SSLEOFError. (Note that sending empty data with the ~socket.socket.send method _does_ raise SSLEOFError in both gevent and the standard library.) Reported in #719 by Mustafa Atik and Tymur Maryokhin, with a reproducible test case provided by Timo Savola.
Python 2: Using the blocking API at import time when multiple greenlets are also importing should not lead to LoopExit. Reported in issue #728 by Garr
OverflowError when using the readline method of the WSGI input stream without a size hint or with a large size hint when the client is uploading a large amount of data. (This only impacted CPython 2; PyPy and Python 3 already handled this.) Reported in issue #289 by ggjjlldd, with contributions by Nathan Hoad.SSLSocket now raises the same ValueError the standard library does, instead of an AttributeError. Found by updating gevent’s copy of the standard library test cases. Initially reported in issue #735 by Dmitrij D. Czarkoff.socket.sendfile.socket.get/set_inheritable.Support the new PEP 466 ssl interfaces on any Python 2 version that supplies them, not just on the versions it officially shipped with. Some Linux dis
Exceptions raised by gevent’s SSL sockets are more consistent with the standard library (e.g., gevent’s Python 3 SSL sockets raise socket.timeout inst
Windows/Python 3: Finish porting the gevent.subprocess module, fixing a large number of failing tests. Examples of failures are in issue #668 and issu
PyPy: Fix a memory leak for code that allocated and disposed of many gevent.lock.Semaphore subclasses. If monkey-patched, this could also apply to thr
PyPy: Fix a memory leak for code that allocated and disposed of many gevent.lock.Semaphore subclasses. If monkey-patched, this could also apply to threading.Semaphore objects. Reported in 660 by Jay Oster.
PyPy: Cython version 0.23.4 or later must be used to avoid a memory leak (`details`_). Thanks to Jay Oster.
Allow subclasses of ~.WSGIHandler to handle invalid HTTP client requests. Reported by not-bob.
~.WSGIServer more robustly supports ~logging.Logger-like parameters for log and error_log (as introduced in 1.1b1, this could cause integration issues with gunicorn). Reported in 663 by Jay Oster.
~gevent.threading._DummyThread objects, created in a monkey-patched system when threading.current_thread is called in a new greenlet (which often happens implicitly, such as when logging) are much lighter weight. For example, they no longer allocate and then delete a ~gevent.lock.Semaphore, which is especially important for PyPy.
Request logging by gevent.pywsgi formats the status code correctly on Python 3. Reported in 664 by Kevin Chen.
Restore the ability to take a weak reference to instances of exactly gevent.lock.Semaphore, which was unintentionally removed as part of making Semaphore atomic on PyPy on 1.1b1. Reported in 666 by Ivan-Zhu.
Build Windows wheels for Python 3.5. Reported in 665 by Hexchain Tong.
gevent.subprocess works under Python 3.5. In general, Python 3.5 has preliminary support. Reported in issue #653 by Squeaky.
Detect and raise an error for several important types of programming errors even if Python interpreter optimizations are enabled with -O or PYTHONOPTI
-O or PYTHONOPTIMIZE. Previously these would go
undetected if optimizations were enabled, potentially leading to
erratic, difficult to debug behaviour.AttributeError from gevent.queue.Queue when peek
was called on an empty Queue. Reported in #643 by michaelvol.SIGCHLD handlers specified to signal.signal work with
the child watchers that are used by default. Also make
os.waitpid work with a first argument of -1. Noted by users of gunicorn.socket.makefile. Reported in #644
by Karan Lyons.Fix an AttributeError from gevent.monkey.patch_builtins on Python 2 when the future_ library is also installed. Reported by Carlos Sanchez.
Fix an AttributeError from gevent.monkey.patch_builtins on Python 2 when the `future`_ library is also installed. Reported by Carlos Sanchez.
PyPy: Fix a DistutilsModuleError or ImportError if the CFFI module backing gevent.core needs to be compiled when the hub is initialized (due to a missing or invalid __pycache__ directory). Now, the module will be automtically compiled when gevent is imported (this may produce compiler output on stdout). Reported in 619 by Thinh Nguyen and 631 by Andy Freeland, with contributions by Jay Oster and Matt Dupre.
PyPy: Improve the performance of gevent.socket.socket:sendall with large inputs. `bench_sendall.py`_ now performs about as well on PyPy as it does on CPython, an improvement of 10x (from ~60MB/s to ~630MB/s). See this `pypy bug`_ for details.
Fix a possible TypeError when calling gevent.socket.wait. Reported in #635 by lanstin.
gevent.socket.socket:sendto properly respects the socket's blocking status (meaning it can raise EWOULDBLOCK now in cases it wouldn't have before). Reported in 634 by Mike Kaplinskiy.
Common lookup errors using the threaded resolver are no longer always printed to stderr since they are usually out of the programmer's control and caught explicitly. (Programming errors like TypeError are still printed.) Reported in 617 by Jay Oster and Carlos Sanchez.
PyPy: Fix a TypeError from gevent.idle(). Reported in 639 by chilun2008.
The imap_unordered methods of a pool support a maxsize parameter to limit the number of results buffered waiting for the consumer. Reported in 638 by Sylvain Zimmer.
The class gevent.queue.Queue now consistently orders multiple blocked waiting put and get callers in the order they arrived. Previously, due to an implementation quirk this was often roughly the case under CPython, but not under PyPy. Now they both behave the same.
The class gevent.queue.Queue now supports the len() function.
Enable the c-ares resolver extension for PyPy.
gevent.monkey.patch_builtins could cause PyPy
to crash. Reported in #618 by Jay Oster.gevent.kill raises the correct exception in the target greenlet.
Reported in #623 by Jonathan Kamens.readable and writable methods to FileObjectPosix;
this fixes e.g., help() on Python 3 when monkey-patched.setup.py can be run from a directory containing spaces. Reported in 319 by Ivan Smirnov.
setup.py can be run from a directory containing spaces. Reported
in :issue:319 by Ivan Smirnov.setup.py can build with newer versions of clang on OS X. They
enforce the distinction between CFLAGS and CPPFLAGS.gevent.lock.Semaphore is atomic on PyPy, just like it is on
CPython. This comes at a small performance cost.successful value to
False when killing a greenlet before it ran with a non-default
exception. Fixed in :pr:608 by Heungsub Lee.os.waitpid to become unreliable
due to the use of signals on POSIX platforms. This was especially
noticeable when using gevent.subprocess in combination with
multiprocessing. Now, the monkey-patched os module provides
a waitpid function that seeks to ameliorate this. Reported in
:issue:600 by champax and :issue:452 by Łukasz Kawczyński.select.poll, provide a
gevent-friendly gevent.select.poll and corresponding
monkey-patch. Implemented in :pr:604 by Eddi Linder.531 by M. Nunberg and implemented in :pr:604.gevent.thread.allocate_lock (and so a monkey-patched standard
library allocate_lock) more closely matches the behaviour of the
builtin: an unlocked lock cannot be released, and attempting to do
so throws the correct exception (thread.error on Python 2,
RuntimeError on Python 3). Previously, over-releasing a lock was
silently ignored. Reported in :issue:308 by Jędrzej Nowak.gevent.fileobject.FileObjectThread uses the threadpool to close
the underling file-like object. Reported in :issue:201 by
vitaly-krugl.gevent.pywsgi handler is handled more robustly, resulting in
"HTTP 400 bad request" responses instead of a 500 error or, in the
worst case, a server-side hang. Reported in :issue:229 by Björn
Lindqvist.threading module before using
gevent.monkey.patch_all() no longer causes Python 3.4 to fail to
get the repr of the main thread, and other CPython platforms to
return an unjoinable DummyThread. (Note that this is not
recommended.) Reported in :issue:153.io package to implement
FileObjectPosix. This unifies the code with the Python 3
implementation, and fixes problems with using seek(). See
:issue:151.108 by shaun and initial fix based on code by
Sylvain Zimmer.gevent.spawn, spawn_raw and spawn_later, as well as the
Greenlet constructor, immediately produce useful TypeErrors
if asked to run something that cannot be run. Previously, the
spawned greenlet would die with an uncaught TypeError the first
time it was switched to. Reported in :issue:119 by stephan.gevent.threadpool.ThreadPool.apply no longer
raises a LoopExit error (using ThreadPool.spawn and then
get on the result still could; you must be careful to use the
correct hub). Reported in :issue:131 by 8mayday.threading module is monkey-patched, the module-level
lock in the logging module is made greenlet-aware, as are the
instance locks of any configured handlers. This makes it safer to
import modules that use the standard pattern of creating a
module-level Logger instance before monkey-patching. Configuring
logging with a basic configuration and then monkey-patching is
also safer (but not configurations that involve such things as the
SocketHandler).threading.RLock under Python 3.RuntimeError
from importlib. Reported in :issue:615 by Daniel Mizyrycki.
(The same thing could happen under Python 2 if a threading.RLock
was held around the monkey-patching call; this is less likely but
not impossible with import hooks.)381 and fixed in :pr:616 by Chris
Lane.pywsgi.WSGIServer accept a
logging.Logger instance for its log and (new) error_log
parameters. Take care that the system is fully monkey-patched very
early in the process's lifetime if attempting this, and note that
non-file handlers have not been tested. Fixes :issue:106.gevent.threadpool.ThreadPool.imap and imap_unordered now accept multiple iterables.
gevent.threadpool.ThreadPool.imap and imap_unordered now accept multiple iterables.
(Experimental) Exceptions raised from iterating using the ThreadPool or Group mapping/application functions should now have the original traceback.
gevent.threadpool.ThreadPool.apply now raises any exception raised by the called function, the same as gevent.pool.Group/Pool and the builtin apply function. This obsoletes the undocumented apply_e function. Original PR #556 by Robert Estelle.
Monkey-patch the selectors module from patch_all and patch_select on Python 3.4. See #591 .
Additional query functions for the gevent.monkey module allow knowing what was patched. Discussed in 135 and implemented in 325 by Nathan Hoad.
In non-monkey-patched environments under Python 2.7.9 or above or Python 3, using a gevent SSL socket could cause the greenlet to block. See 597 by David Ford.
gevent.socket.socket.sendall supports arbitrary objects that implement the buffer protocol (such as ctypes structures), just like native sockets. Reported in 466 by tzickel.
Added support for the onerror attribute present in CFFI 1.2.0 for better signal handling under PyPy. Thanks to Armin Rigo and Omer Katz. (See https://bitbucket.org/cffi/cffi/issue/152/handling-errors-from-signal-handlers-in)
The gevent.subprocess module is closer in behaviour to the standard library under Python 3, at least on POSIX. The pass_fds, restore_signals, and start_new_session arguments are now unimplemented, as are the timeout parameters to various functions. Under Python 2, the previously undocumented timeout parameter to Popen.communicate raises an exception like its Python 3 counterpart.
An exception starting a child process with the gevent.subprocess module no longer leaks file descriptors. Reported in 374 by 陈小玉.
The example echoserver.py no longer binds to the standard X11 TCP port. Reported in 485 by minusf.
gevent.iwait no longer throws LoopExit if the caller switches greenlets between return values. Reported and initial patch in 467 by Alexey Borzenkov.
The default threadpool and default threaded resolver work in a forked child process, such as with multiprocessing.Process. Previously the child process would hang indefinitely. Reported in 230 by Lx Yu.
Fork watchers are more likely to (eventually) get called in a multi-threaded program.
gevent.killall accepts an arbitrary iterable for the greenlets to kill. Reported in 404 by Martin Bachwerk; seen in combination with older versions of simple-requests.
gevent.local.local objects are now eligible for garbage collection as soon as the greenlet finishes running, matching the behaviour of the built-in threading.local (when implemented natively). Reported in 387 by AusIV.
Killing a greenlet (with gevent.kill or gevent.greenlet.Greenlet.kill) before it is actually started and switched to now prevents the greenlet from ever running, instead of raising an exception when it is later switched to. See 330 reported by Jonathan Kamens.
See the changelog for a detailed list of changes.
See the changelog for a detailed list of changes.
See https://github.com/gevent/gevent/blob/1.0.2/changelog.rst#release-102-may-23-2015 for a list of changes.
See https://github.com/gevent/gevent/blob/1.0.2/changelog.rst#release-102-may-23-2015 for a list of changes.
See https://github.com/surfly/gevent/blob/1.0.x/changelog.rst#release-101-apr-30-2014 for list of changes
See https://github.com/surfly/gevent/blob/1.0.x/changelog.rst#release-101-apr-30-2014 for list of changes
pywsgi: Pass copy of error list instead of direct reference. Thanks to Jonathan Kamens, Matt Iversen.
Fixed issue #80: gevent.httplib failed with RequestFailed errors because timeout was reset to 1s. Patch by Tomasz Prus.
Fixed #94: fallback to buffer if memoryview fails in _get_memory on python 2.7.
Queue(None).full() returns False now (previously it returned True).Added __copy__ method to gevent.local.local class that implements copy semantics compatible with built-in threading.local. Patch by Galfy Pundee.
Added __copy__ method to gevent.local.local class that implements copy semantics compatible with built-in threading.local. Patch by Galfy Pundee.
Fixed StreamServer class to catch EWOULDBLOCK rather than EAGAIN. This fixes lots of spurious tracebacks on Windows where these two constants are not the same. Patch by Alexey Borzenkov.
Fixed issue #65: fork now calls event_reinit only in the child process; otherwise the process could hang when using libevent2. Patch by Alexander Boudkar.
Fixed build problem on Python 2.5
Fixed TypeError that occurred when environ["wsgi.input"].read function was called with an integer argument.
Fixed TypeError that occurred when environ["wsgi.input"].read function was called with an integer argument.
Fixed issue #63: monkey.patch_thread now patches threading too, even if it's already imported. Patch by Shaun Lindsay.
Fixed issue #64: joinall and killall functions used to hang if their argument contained duplicate greenlets.
Fixed issue #69: pywsgi.WSGIServer reported "Connection reset by peer" if the client did not close the connection gracefully after the last request. Such errors are now ignored.
Fixed issue #67: Made wsgi.WSGIServer add REQUEST_URI to environ. Patch by Andreas Blixt.
Fixed issue #71: monkey patching httplib with gevent.httplib used to break HTTPSConnection. Patch by Nick Barkas.
Fixed issue #74: create_connection now raises proper exception when getaddrinfo fails.
Fixed BaseServer.__repr__ method, BaseServer.server_host and BaseServer.server_port attributes to handle the case of AF_UNIX addresses properly. Previously they assumed address is always a tuple.
Fixed pywsgi.WSGIServer to handle AF_UNIX listeners. The server now sets environ["SERVER_NAME"] and environ["SERVER_PORT"] to empty string in such case.
Make StreamServer (and thus pywsgi.WSGIServer) accept up to 100 connections per one readiness notification. This behaviour is controlled by StreamServer.max_accept class attribute.
If bind fails, the servers now include the address that caused bind to fail in the error message.
Fixed typo in gevent.httplib that rendered it unusable.
Fixed typo in gevent.httplib that rendered it unusable.
Removed unnecessary delay in getaddrinfo by calling resolve_ipv4 and resolve_ipv6 concurrently rather than sequentially in AF_UNSPEC case.
Added gevent.httplib -- experimental support for libevent-http client (issue #9). Thanks to Tommie Gannert, Örjan Persson.
Added 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.wsgi with libevent2 (issue #62).
Fixed compilation issues with libevent2. Patch by Ralf Schmitt.
Fixed pywsgi not 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.
Fixed socket.getaddrinfo to handle AF_UNSPEC properly and resolve service names (issue #56). Thanks to Elizabeth Jennifer Myers.
Fixed socket.getaddrinfo to handle international domain names.
Fixed leaking of traceback object when switching out of greenlet with sys.exc_info set. Leaking is prevented by not preserving traceback at all and only keeping the value of the exception. Thanks to Ned Rockson.
Fixed ssl.SSLSocket.unwrap to shutdown SSLSocket properly, without raising SSLError(read operation timeout).
Fixed TypeError inside Hub on Python 2.4.
Made a number of internal improvements to gevent.pywsgi to make subclassing easier.
Changed WSGIServer to explicitly close the socket after the last request. Patch by Ralf Schmitt.
Fixed pywsgi.WSGIHandler not to add CONTENT_TYPE to the environ dict when there's no Content-Type header in the request. Previously a default text/plain was added in such case.
Added proper implementation of imap_unordered to Pool class. 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 Pool.imap_unordered.
Fixed BaseServer.started property: it is now set to True after start until stop or kill. Previously it could become False for short period of times, because StreamServer could stop accepting for a while in presence of errors and StreamServer.started was defined as "whether the server is currently accepting".
Fixed wsgi.WSGIServer to reply with 500 error immediatelly if the application raises an error (issue #58). Thanks to Jon Aslund.
Added monkey.patch_httplib function which is disabled by default.
Added httplib parameter to monkey.patch_all (defaults to False).
Added write method to core.buffer.
Fixed OverflowError that could happen in core.event.__str__.
Made http_request.get_input_headers return header names in lower case.
Fixed StreamServer to accept ciphers as an SSL argument.
Added build_exc --cython= option to setup.py. Patch by Ralf Schmitt.
Updated local to raise AttributeError if __dict__ attribute is set or deleted.
Deprecated gevent.sslold module.
Release highlights:
Fixed monkey to patch socket.create_connection.
Updated gevent.ssl module to fully match the functionality of ssl on Python 2.7.
Fixed Group.join to handle raise_error=True properly, it used to raise TypeError (issue #36). Thanks to by David Hain.
Fixed gevent.wsgi and gevent.pywsgi to join multiple Cookie headers (issue #40).
Fixed select to recognize long arguments in addition to int.
Fixed Semaphore.acquire to return False when timeout expires instead of raising AssertionError (issue #39). Patch by Erik Näslund.
Fixed JoinableQueue.join to return immediatelly if queue is already empty (issue #45). Patch by Dmitry Chechik.
Deprecated gevent.sslold module.
gevent.socket module:
Overrode socket.shutdown method to interrupt read/write operations on socket.
Fixed possible NameError in socket.connect_ex method. Patch by Alexey Borzenkov.
Fixed socket leak in create_connection function.
Made gevent.socket import all public items from stdlib socket that do not do I/O.
gevent.ssl module:
Imported a number of patches from stdlib by Antoine Pitrou:
Calling makefile method on an SSL object would prevent the underlying socket from being closed until all objects get truely destroyed (Python issue #5238).
SSL handshake would ignore the socket timeout and block indefinitely if the other end didn't respond (Python issue #5103).
When calling getpeername in SSLSocket.__init__, only silence exceptions caused by the "socket not connected" condition.
Added support for ciphers argument.
Updated SSLSocket.send and SSLSocket.recv methods to match the behavior of stdlib ssl better.
Fixed ssl.SSLObject to delete events used by other greenlets when closing the instance (issue #34).
Miscellaneous:
Made BaseServer accept long values as pool argument in addition to int.
Made http._requests attribute public.
Updated webchat example to use file on disk rather than in-memory sqlite database to avoid OperationalError.
Fixed webproxy.py example to be runnable under external WSGI server.
Fixed bogus failure in test__exc_info.py.
Added new test to check PEP8 conformance: xtest_pep8.py.
Fixed BackdoorServer close the connection on SystemExit and simplified the code.
Made Pool raise ValueError when initialized with size=0.
Updated setup.py --libevent to configure and make libevent if it's not built already.
Updated setup.py to use setuptools if present and add dependency on greenlet.
Fixed doc/mysphinxext.py to work with Sphinx 1. Thanks by Örjan Persson.
Removed deprecated backdoor.backdoor_server function.
Release highlights:
Added gevent.server module with StreamServer class for easy implementing of TCP and SSL servers.
Added gevent.baseserver module with BaseServer class.
Added new implementation of gevent.pywsgi based on gevent.server. Contributed by Ralf Schmitt.
Added gevent.local module. Fixed issue #24. Thanks to Ted Suzman.
Fixed a number of bugs in gevent.wsgi module.
Fixed issue #26: closing a socket now interrupts all pending read/write operations on it.
Implemented workaround that prevents greenlets from leaking exc_info.
Fixed socket.sendall to use buffer object to prevent string copies.
Made the interfaces of gevent.wsgi and gevent.pywsgi much 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.
Backward-incompatible changes:
Blocking is now the default behaviour for the Greenlet.kill method and other kill* methods.
Changed the inteface of http.HTTPServer to match the interface of other servers.
Changed Pool's spawn method to block until there's a free slot.
Removed deprecated backdoor.backdoor_server function.
Removed deprecated functions in socket module:
socket_bind_and_listen
set_reuse_addr
connect_tcp
tcp_server
Removed deprecated socket.fd property.
Deprecated use of negative numbers to indicate infinite timeout in core.event.add and socket.wait_read and similar. Use None from now on, which is compatible with the previous versions.
Derived backdoor.BackdoorServer from StreamServer rather than from Greenlet. This adds lots of new features and removes a few old ones.
Removed non-standard balance property from Semaphore.
Removed start, set_cb and set_gencb from core.http.
Removed set_closecb from core.http_connection. It is now used internally to detach the requests of the closed connections.
Deprecated rawgreenlet module.
Deprecated util.lazy_property.
Renamed GreenletSet to Group. The old name is currently available as an alias.
gevent.socket module:
Fixed issues #26 and #34: closing the socket while reading/writing/connecting is now safe. Thanks to Cyril Bay.
Imported getfqdn from socket module.
The module now uses sys.platform to detect Windows rather than platform module.
Fixed issue #27: getaddrinfo used to handle the case when socktype or proto were equal to 0. Thanks to Randall Leeds.
gevent.coros module:
Added RLock class.
Added DummySemaphore class.
Fixed BoundedSemaphore class to behave like threading.BoundedSemaphore behaves.
gevent.event module:
Made Event.wait return internal flag instead of None.
Made AsyncResult.wait return its value instead of None.
Added ready method as an alias for is_set.
gevent.wsgi module:
Removed wsgi.buffer_proxy.
gevent.pywsgi module:
Rewritten to use server and not to depend on BaseHTTPServer.
Changed the interface to match wsgi module. Removed server function, add Server class, added WSGIServer class.
Renamed HttpProtocol to WSGIHandler.
Fixed compatibility with webob by allowing an optional argument to readline.
gevent.core module:
Fixed reference leaks in event class.
Avoid Python name lookups when accessing EV_* constants from Cython code. Patch by Daniele Varrazzo.
Added persist argument to read_event, write_event and readwrite_event.
Made all of the event loop callbacks clear the exception info before exiting.
Added flags_str property to event. It is used by __str__ and __repr__.
buffer:
Added detach method.
Implemented iterator protocol.
Fixed readline and readlines methods.
http_request:
Fixed 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.
Made input_buffer and output_buffer store and reuse the buffer object they create.
Fixed __str__ and meth:__repr__ to include spaces where needed.
http class no longer has set_cb and set_gencb. Instead its contructor accepts handle which will be called on each request.
gevent.http and gevent.wsgi modules:
Made HTTPServer use "Connection: close" header by default.
Class HTTPServer now 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 Pool instance. 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_request which will send 500 reply when deallocated if the user hasn't send any.
Miscellaneous:
Changed gevent.thread to use Greenlet instead of raw greenlets. This means monkey patched thread will become Greenlet too.
Added started property to Greenlet.
Put common server code in gevent.baseserver module. All servers in gevent package are now derived from BaseServer.
Fixed issue #20: sleep now raises IOError if passed a negative argument.
Remove the code related to finding out libevent version from setup.py as macro USE_LIBEVENT_? is no longer needed to build gevent.core.
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.
Silented SystemError raised in backdoor when a client typed quit().
If importing greenlet failed with ImportError, keep the original error message, because sometimes the error originates in setuptools.
Changed select.select to return all the file descriptors signalled, not just the first one.
Made thread (and thus monkey patched threads) to spawn Greenlet instances, rather than raw greenlets.
Examples:
Updated echoserver.py to use StreamServer.
Added geventsendfile.py.
Added wsgiserver_ssl.py.
Thanks to Ralf Schmitt for pywsgi, a number of fixes for wsgi, help with baseserver and server modules, improving setup.py and various other patches and suggestions.
Thanks to Uriel Katz for pywsgi patches.
Fixed http server to put the listening socket into a non-blocking mode. Contributed by Ralf Schmitt.
Removed a symlink from the distribution (that causes pip to fail). Thanks to Brad Clements for reporting it.
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.
Renamed socket_bind_and_listen to socket.bind_and_listen. The old name is still available as a deprecated alias.
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. 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.
Fixed wsgi to unquote environ['PATH_INFO'] before passing to application.
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.
Fixed bug in select.select function. Passing non-empty list of write descriptors used to cause this function to fail.
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.
Fixed timeout bug in joinall, Greenlet.join, pool.Pool.join: if timeout has expired it used to raise Timeout; now it returns silently.
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.
The following items were marked as deprecated:
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:
spawn_link
spawn_link_value
spawn_link_exception
spawn_raw
joinall
killall
Greenlet
GreenletExit
core
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:
gevent.hub provides Hub class and basic utilities, like sleep; Hub is now a subclass of greenlet.
gevent.timeout provides Timeout and with_timeout;
gevent.greenlet provides Greenlet class and helpers like joinall and killall.
gevent.rawgreenlet contains the old "polling" versions of joinall and killall (they do not need link functionality 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.
LifoQueue and PriorityQueue are implemented as well. gevent.queue will deprecate both coros.Queue and coros.Channel.
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.
Simplified gevent.socket's implementation and fixed SSL bug reported on eventletdev by Cesar Alaniz as well as failures in test_socket_ssl.py.
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. The gevent.socket is 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 release 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.
Your coding agent can read these notes before it upgrades. Set up the MCP server →