Commit 4780e09c authored by Jason Madden's avatar Jason Madden

Update changelog with more links; add more/update/fix ..versionXXX in docstrings.

parent 39eb5eaf
...@@ -49,10 +49,12 @@ ...@@ -49,10 +49,12 @@
Also raise the correct exceptions for unconnected SSL sockets and Also raise the correct exceptions for unconnected SSL sockets and
properly validate SSL hostnames. Found via updated standard library properly validate SSL hostnames. Found via updated standard library
tests. tests.
- Python 3: Add missing support for ``socket.socket.sendfile``. Found via updated - Python 3: Add missing support for :meth:`socket.socket.sendfile`. Found via updated
standard library tests. standard library tests.
- Python 3.4+: Add missing support for ``socket.get/set_inheritable``. Found - Python 3.4+: Add missing support for
via updated standard library tests. :meth:`socket.socket.get_inheritable` and
:meth:`~socket.socket.set_inheritable`. Found via updated standard
library tests.
1.1rc3 (Jan 04, 2016) 1.1rc3 (Jan 04, 2016)
===================== =====================
...@@ -89,7 +91,7 @@ ...@@ -89,7 +91,7 @@
``sendall``. ``sendall``.
- gevent's SSL socket's ``sendall`` method should no longer raise ``SSL3_WRITE_PENDING`` - gevent's SSL socket's ``sendall`` method should no longer raise ``SSL3_WRITE_PENDING``
in rare cases when sending large buffers. Reported in :issue:`317`. in rare cases when sending large buffers. Reported in :issue:`317`.
- ``gevent.signal`` now allows resetting (SIG_DFL) and ignoring (SIG_IGN) the - :func:`gevent.signal.signal` now allows resetting (SIG_DFL) and ignoring (SIG_IGN) the
SIGCHLD signal at the process level (although this may allow race SIGCHLD signal at the process level (although this may allow race
conditions with libev child watchers). Reported in :issue:`696` by conditions with libev child watchers). Reported in :issue:`696` by
Adam Ning. Adam Ning.
...@@ -180,16 +182,16 @@ ...@@ -180,16 +182,16 @@
1.1b5 (Sep 18, 2015) 1.1b5 (Sep 18, 2015)
==================== ====================
- ``gevent.subprocess`` works under Python 3.5. In general, Python 3.5 - :mod:`gevent.subprocess` works under Python 3.5. In general, Python 3.5
has preliminary support. Reported in :issue:`653` by Squeaky. has preliminary support. Reported in :issue:`653` by Squeaky.
- ``gevent.subprocess.Popen.communicate`` honors a ``timeout`` - :func:`Popen.communicate <gevent.subprocess.Popen.communicate>` honors a ``timeout``
argument even if there is no way to communicate with the child argument even if there is no way to communicate with the child
process (none of stdin, stdout and stderr were set to ``PIPE``). process (none of stdin, stdout and stderr were set to ``PIPE``).
Noticed as part of the Python 3.5 test suite for the new function Noticed as part of the Python 3.5 test suite for the new function
``subprocess.run`` but impacts all versions (``timeout`` is an ``subprocess.run`` but impacts all versions (``timeout`` is an
official argument under Python 3 and a gevent extension with official argument under Python 3 and a gevent extension with
slightly different semantics under Python 2). slightly different semantics under Python 2).
- Fix a possible ``ValueError`` from ``gevent.queue.Queue:peek``. - Fix a possible ``ValueError`` from :meth:`Queue.peek <gevent.queue.Queue.peek>`.
Reported in :issue:`647` by Kevin Chen. Reported in :issue:`647` by Kevin Chen.
- Restore backwards compatibility for using ``gevent.signal`` as a - Restore backwards compatibility for using ``gevent.signal`` as a
callable, which, depending on the order of imports, could be broken callable, which, depending on the order of imports, could be broken
...@@ -197,7 +199,7 @@ ...@@ -197,7 +199,7 @@
:issue:`648` by Sylvain Zimmer. :issue:`648` by Sylvain Zimmer.
- gevent blocking operations performed at the top-level of a module - gevent blocking operations performed at the top-level of a module
after the system was monkey-patched under Python 2 could result in after the system was monkey-patched under Python 2 could result in
raising a ``LoopExit`` instead of completing the expected blocking raising a :exc:`~gevent.hub.LoopExit` instead of completing the expected blocking
operation. Note that performing gevent blocking operations in the operation. Note that performing gevent blocking operations in the
top-level of a module is typically not recommended, but this top-level of a module is typically not recommended, but this
situation can arise when monkey-patching existing scripts. Reported situation can arise when monkey-patching existing scripts. Reported
...@@ -206,20 +208,21 @@ ...@@ -206,20 +208,21 @@
(monkey-patched) ``os.forkpty`` and ``pty.fork`` functions in the (monkey-patched) ``os.forkpty`` and ``pty.fork`` functions in the
same way they do for the ``os.fork`` function. Reported in same way they do for the ``os.fork`` function. Reported in
:issue:`650` by Erich Heine. :issue:`650` by Erich Heine.
- ``gevent.pywsgi.WSGIServer`` (``WSGIHandler``) does a better job detecting and - :class:`~gevent.pywsgi.WSGIServer` and
:class:`~gevent.pywsgi.WSGIHandler` do a better job detecting and
reporting potential encoding errors for headers and the status line reporting potential encoding errors for headers and the status line
during ``start_response`` as recommended by the `WSGI specification`_. during :meth:`~gevent.pywsgi.WSGIHandler.start_response` as recommended by the `WSGI
In addition, under Python 2, unnecessary encodings and decodings specification`_. In addition, under Python 2, unnecessary encodings
(often a trip through the ASCII encoding) are avoided for conforming and decodings (often a trip through the ASCII encoding) are avoided
applications. This is an enhancement of an already documented and for conforming applications. This is an enhancement of an already
partially enforced constraint: beginning in 1.1a1, under Python 2, documented and partially enforced constraint: beginning in 1.1a1,
``u'abc'`` would typically previously have been allowed, but under Python 2, ``u'abc'`` would typically previously have been
``u'\u1f4a3'`` would not; now, neither will be allowed, more closely allowed, but ``u'\u1f4a3'`` would not; now, neither will be allowed,
matching the specification, improving debugability and performance more closely matching the specification, improving debugability and
and allowing for better error handling both by the application and performance and allowing for better error handling both by the
by gevent (previously, certain encoding errors could result in application and by gevent (previously, certain encoding errors could
gevent writing invalid/malformed HTTP responses). Reported by Greg result in gevent writing invalid/malformed HTTP responses). Reported
Higgins and Carlos Sanchez. by Greg Higgins and Carlos Sanchez.
- Code coverage by tests is now reported on `coveralls.io`_. - Code coverage by tests is now reported on `coveralls.io`_.
.. _WSGI specification: https://www.python.org/dev/peps/pep-3333/#the-start-response-callable .. _WSGI specification: https://www.python.org/dev/peps/pep-3333/#the-start-response-callable
...@@ -235,9 +238,11 @@ ...@@ -235,9 +238,11 @@
erratic, difficult to debug behaviour. erratic, difficult to debug behaviour.
- Fix an ``AttributeError`` from ``gevent.queue.Queue`` when ``peek`` - Fix an ``AttributeError`` from ``gevent.queue.Queue`` when ``peek``
was called on an empty ``Queue``. Reported in :issue:`643` by michaelvol. was called on an empty ``Queue``. Reported in :issue:`643` by michaelvol.
- Make ``SIGCHLD`` handlers specified to ``signal.signal`` work with - Make ``SIGCHLD`` handlers specified to :func:`gevent.signal.signal` work with
the child watchers that are used by default. Also make the child watchers that are used by default. Also make
``os.waitpid`` work with a first argument of -1. Noted by users of gunicorn. :func:`gevent.os.waitpid` work with a first argument of -1. (Also
applies to the corresponding monkey-patched stdlib functions.)
Noted by users of gunicorn.
- Under Python 2, any timeout set on a socket would be ignored when - Under Python 2, any timeout set on a socket would be ignored when
using the results of ``socket.makefile``. Reported in :issue:`644` using the results of ``socket.makefile``. Reported in :issue:`644`
by Karan Lyons. by Karan Lyons.
...@@ -271,15 +276,16 @@ ...@@ -271,15 +276,16 @@
printed.) Reported in :issue:`617` by Jay Oster and Carlos Sanchez. printed.) Reported in :issue:`617` by Jay Oster and Carlos Sanchez.
- PyPy: Fix a ``TypeError`` from ``gevent.idle()``. Reported in - PyPy: Fix a ``TypeError`` from ``gevent.idle()``. Reported in
:issue:`639` by chilun2008. :issue:`639` by chilun2008.
- The ``imap_unordered`` methods of a pool support a ``maxsize`` - The :func:`~gevent.pool.Pool.imap_unordered` methods of a pool-like
parameter to limit the number of results buffered waiting for the object support a ``maxsize`` parameter to limit the number of
consumer. Reported in :issue:`638` by Sylvain Zimmer. results buffered waiting for the consumer. Reported in :issue:`638`
- The class ``gevent.queue.Queue`` now consistently orders multiple by Sylvain Zimmer.
- The class :class:`gevent.queue.Queue` now consistently orders multiple
blocked waiting ``put`` and ``get`` callers in the order they blocked waiting ``put`` and ``get`` callers in the order they
arrived. Previously, due to an implementation quirk this was often arrived. Previously, due to an implementation quirk this was often
roughly the case under CPython, but not under PyPy. Now they both roughly the case under CPython, but not under PyPy. Now they both
behave the same. behave the same.
- The class ``gevent.queue.Queue`` now supports the ``len()`` function. - The class :class:`gevent.queue.Queue` now supports the :func:`len` function.
.. _future: http://python-future.org .. _future: http://python-future.org
.. _bench_sendall.py: https://raw.githubusercontent.com/gevent/gevent/master/greentest/bench_sendall.py .. _bench_sendall.py: https://raw.githubusercontent.com/gevent/gevent/master/greentest/bench_sendall.py
...@@ -294,12 +300,14 @@ ...@@ -294,12 +300,14 @@
- On some versions of PyPy on some platforms (notably 2.6.0 on 64-bit - On some versions of PyPy on some platforms (notably 2.6.0 on 64-bit
Linux), enabling ``gevent.monkey.patch_builtins`` could cause PyPy Linux), enabling ``gevent.monkey.patch_builtins`` could cause PyPy
to crash. Reported in :issue:`618` by Jay Oster. to crash. Reported in :issue:`618` by Jay Oster.
- ``gevent.kill`` raises the correct exception in the target greenlet. - :func:`gevent.kill` raises the correct exception in the target greenlet.
Reported in :issue:`623` by Jonathan Kamens. Reported in :issue:`623` by Jonathan Kamens.
- Various fixes on Windows. Reported in :issue:`625`, :issue:`627`, - Various fixes on Windows. Reported in :issue:`625`, :issue:`627`,
and :issue:`628` by jacekt and Yuanteng (Jeff) Pei. Fixed in :pr:`624`. and :issue:`628` by jacekt and Yuanteng (Jeff) Pei. Fixed in :pr:`624`.
- Add ``readable`` and ``writable`` methods to ``FileObjectPosix``; - Add :meth:`~gevent.fileobject.FileObjectPosix.readable` and
this fixes e.g., help() on Python 3 when monkey-patched. :meth:`~gevent.fileobject.FileObjectPosix.writable` methods to
:class:`~gevent.fileobject.FileObjectPosix`; this fixes e.g., help() on Python 3 when
monkey-patched.
1.1b1 (Jul 17, 2015) 1.1b1 (Jul 17, 2015)
==================== ====================
...@@ -313,28 +321,28 @@ ...@@ -313,28 +321,28 @@
- Fixed regression that failed to set the ``successful`` value to - Fixed regression that failed to set the ``successful`` value to
False when killing a greenlet before it ran with a non-default False when killing a greenlet before it ran with a non-default
exception. Fixed in :pr:`608` by Heungsub Lee. exception. Fixed in :pr:`608` by Heungsub Lee.
- libev's child watchers caused ``os.waitpid`` to become unreliable - libev's child watchers caused :func:`os.waitpid` to become unreliable
due to the use of signals on POSIX platforms. This was especially due to the use of signals on POSIX platforms. This was especially
noticeable when using ``gevent.subprocess`` in combination with noticeable when using :mod:`gevent.subprocess` in combination with
``multiprocessing``. Now, the monkey-patched ``os`` module provides ``multiprocessing``. Now, the monkey-patched ``os`` module provides
a ``waitpid`` function that seeks to ameliorate this. Reported in a :func:`~gevent.os.waitpid` function that seeks to ameliorate this. Reported in
:issue:`600` by champax and :issue:`452` by Łukasz Kawczyński. :issue:`600` by champax and :issue:`452` by Łukasz Kawczyński.
- On platforms that implement ``select.poll``, provide a - On platforms that implement :class:`select.poll`, provide a
gevent-friendly ``gevent.select.poll`` and corresponding gevent-friendly :class:`gevent.select.poll` and corresponding
monkey-patch. Implemented in :pr:`604` by Eddi Linder. monkey-patch. Implemented in :pr:`604` by Eddi Linder.
- Allow passing of events to the io callback under PyPy. Reported in - Allow passing of events to the io callback under PyPy. Reported in
:issue:`531` by M. Nunberg and implemented in :pr:`604`. :issue:`531` by M. Nunberg and implemented in :pr:`604`.
- ``gevent.thread.allocate_lock`` (and so a monkey-patched standard - :func:`gevent.thread.allocate_lock` (and so a monkey-patched standard
library ``allocate_lock``) more closely matches the behaviour of the library :func:`~thread.allocate_lock`) more closely matches the behaviour of the
builtin: an unlocked lock cannot be released, and attempting to do builtin: an unlocked lock cannot be released, and attempting to do
so throws the correct exception (``thread.error`` on Python 2, so throws the correct exception (``thread.error`` on Python 2,
``RuntimeError`` on Python 3). Previously, over-releasing a lock was ``RuntimeError`` on Python 3). Previously, over-releasing a lock was
silently ignored. Reported in :issue:`308` by Jędrzej Nowak. silently ignored. Reported in :issue:`308` by Jędrzej Nowak.
- ``gevent.fileobject.FileObjectThread`` uses the threadpool to close - :class:`gevent.fileobject.FileObjectThread` uses the threadpool to close
the underling file-like object. Reported in :issue:`201` by the underling file-like object. Reported in :issue:`201` by
vitaly-krugl. vitaly-krugl.
- Malicious or malformed HTTP chunked transfer encoding data sent to - Malicious or malformed HTTP chunked transfer encoding data sent to
the ``gevent.pywsgi`` handler is handled more robustly, resulting in the :class:`pywsgi handler <gevent.pywsgi.WSGIHandler>` is handled more robustly, resulting in
"HTTP 400 bad request" responses instead of a 500 error or, in the "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 worst case, a server-side hang. Reported in :issue:`229` by Björn
Lindqvist. Lindqvist.
...@@ -344,7 +352,7 @@ ...@@ -344,7 +352,7 @@
return an unjoinable DummyThread. (Note that this is not return an unjoinable DummyThread. (Note that this is not
recommended.) Reported in :issue:`153`. recommended.) Reported in :issue:`153`.
- Under Python 2, use the ``io`` package to implement - Under Python 2, use the ``io`` package to implement
``FileObjectPosix``. This unifies the code with the Python 3 :class:`~gevent.fileobject.FileObjectPosix`. This unifies the code with the Python 3
implementation, and fixes problems with using ``seek()``. See implementation, and fixes problems with using ``seek()``. See
:issue:`151`. :issue:`151`.
- Under Python 2, importing a module that uses gevent blocking - Under Python 2, importing a module that uses gevent blocking
...@@ -352,35 +360,37 @@ ...@@ -352,35 +360,37 @@
produces import errors (Python 3 handles this case natively). produces import errors (Python 3 handles this case natively).
Reported in :issue:`108` by shaun and initial fix based on code by Reported in :issue:`108` by shaun and initial fix based on code by
Sylvain Zimmer. Sylvain Zimmer.
- ``gevent.spawn``, ``spawn_raw`` and ``spawn_later``, as well as the - :func:`gevent.spawn`, :func:`spawn_raw` and :func:`spawn_later`, as well as the
``Greenlet`` constructor, immediately produce useful ``TypeErrors`` :class:`~gevent.Greenlet` constructor, immediately produce useful ``TypeErrors``
if asked to run something that cannot be run. Previously, the if asked to run something that cannot be run. Previously, the
spawned greenlet would die with an uncaught ``TypeError`` the first spawned greenlet would die with an uncaught ``TypeError`` the first
time it was switched to. Reported in :issue:`119` by stephan. time it was switched to. Reported in :issue:`119` by stephan.
- Recursive use of ``gevent.threadpool.ThreadPool.apply`` no longer - Recursive use of :meth:`ThreadPool.apply
raises a ``LoopExit`` error (using ``ThreadPool.spawn`` and then <gevent.threadpool.ThreadPool.apply>` no longer raises a
``get`` on the result still could; you must be careful to use the ``LoopExit`` error (using ``ThreadPool.spawn`` and then ``get`` on
correct hub). Reported in :issue:`131` by 8mayday. the result still could; you must be careful to use the correct hub).
- When the ``threading`` module is monkey-patched, the module-level Reported in :issue:`131` by 8mayday.
lock in the ``logging`` module is made greenlet-aware, as are the - When the :mod:`threading` module is :func:`monkey-patched
instance locks of any configured handlers. This makes it safer to <gevent.monkey.patch_thread>`, the module-level lock in the
import modules that use the standard pattern of creating a :mod:`logging` module is made greenlet-aware, as are the instance
module-level ``Logger`` instance before monkey-patching. Configuring locks of any configured handlers. This makes it safer to import
``logging`` with a basic configuration and then monkey-patching is modules that use the standard pattern of creating a module-level
also safer (but not configurations that involve such things as the :class:`~logging.Logger` instance before monkey-patching.
``SocketHandler``). Configuring ``logging`` with a basic configuration and then
- Fix monkey-patching of ``threading.RLock`` under Python 3. monkey-patching is also safer (but not configurations that involve
such things as the ``SocketHandler``).
- Fix monkey-patching of :class:`threading.RLock` under Python 3.
- Under Python 3, monkey-patching at the top-level of a module that - Under Python 3, monkey-patching at the top-level of a module that
was imported by another module could result in a ``RuntimeError`` was imported by another module could result in a :exc:`RuntimeError`
from ``importlib``. Reported in :issue:`615` by Daniel Mizyrycki. from :mod:`importlib`. Reported in :issue:`615` by Daniel Mizyrycki.
(The same thing could happen under Python 2 if a ``threading.RLock`` (The same thing could happen under Python 2 if a ``threading.RLock``
was held around the monkey-patching call; this is less likely but was held around the monkey-patching call; this is less likely but
not impossible with import hooks.) not impossible with import hooks.)
- Fix configuring c-ares for a 32-bit Python when running on a 64-bit - Fix configuring c-ares for a 32-bit Python when running on a 64-bit
platform. Reported in :issue:`381` and fixed in :pr:`616` by Chris platform. Reported in :issue:`381` and fixed in :pr:`616` by Chris
Lane. Additional fix in :pr:`626` by Kevin Chen. Lane. Additional fix in :pr:`626` by Kevin Chen.
- (Experimental) Let the ``pywsgi.WSGIServer`` accept a - (Experimental) Let the :class:`pywsgi.WSGIServer` accept a
``logging.Logger`` instance for its ``log`` and (new) ``error_log`` :class:`logging.Logger` instance for its ``log`` and (new) ``error_log``
parameters. Take care that the system is fully monkey-patched very parameters. Take care that the system is fully monkey-patched very
early in the process's lifetime if attempting this, and note that early in the process's lifetime if attempting this, and note that
non-file handlers have not been tested. Fixes :issue:`106`. non-file handlers have not been tested. Fixes :issue:`106`.
...@@ -393,11 +403,11 @@ ...@@ -393,11 +403,11 @@
- (Experimental) Exceptions raised from iterating using the - (Experimental) Exceptions raised from iterating using the
``ThreadPool`` or ``Group`` mapping/application functions should now ``ThreadPool`` or ``Group`` mapping/application functions should now
have the original traceback. have the original traceback.
- ``gevent.threadpool.ThreadPool.apply`` now raises any exception - :meth:`gevent.threadpool.ThreadPool.apply` now raises any exception
raised by the called function, the same as raised by the called function, the same as
``gevent.pool.Group``/``Pool`` and the builtin ``apply`` function. :class:`~gevent.pool.Group`/:class:`~gevent.pool.Pool` and the
This obsoletes the undocumented ``apply_e`` function. Original PR builtin :func:`apply` function. This obsoletes the undocumented
:issue:`556` by Robert Estelle. ``apply_e`` function. Original PR :issue:`556` by Robert Estelle.
- Monkey-patch the ``selectors`` module from ``patch_all`` and - Monkey-patch the ``selectors`` module from ``patch_all`` and
``patch_select`` on Python 3.4. See :issue:`591`. ``patch_select`` on Python 3.4. See :issue:`591`.
- Additional query functions for the :mod:`gevent.monkey` module - Additional query functions for the :mod:`gevent.monkey` module
...@@ -406,41 +416,42 @@ ...@@ -406,41 +416,42 @@
- In non-monkey-patched environments under Python 2.7.9 or above or - 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 Python 3, using a gevent SSL socket could cause the greenlet to
block. See :issue:`597` by David Ford. block. See :issue:`597` by David Ford.
- ``gevent.socket.socket.sendall`` supports arbitrary objects that - :meth:`gevent.socket.socket.sendall` supports arbitrary objects that
implement the buffer protocol (such as ctypes structures), just like implement the buffer protocol (such as ctypes structures), just like
native sockets. Reported in :issue:`466` by tzickel. native sockets. Reported in :issue:`466` by tzickel.
- Added support for the ``onerror`` attribute present in CFFI 1.2.0 - Added support for the ``onerror`` attribute present in CFFI 1.2.0
for better signal handling under PyPy. Thanks to Armin Rigo and Omer 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) 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 - The :mod:`gevent.subprocess` module is closer in behaviour to the
standard library under Python 3, at least on POSIX. The standard library under Python 3, at least on POSIX. The
``pass_fds``, ``restore_signals``, and ``start_new_session`` ``pass_fds``, ``restore_signals``, and ``start_new_session``
arguments are now unimplemented, as are the ``timeout`` parameters arguments are now implemented, as are the ``timeout`` parameters
to various functions. Under Python 2, the previously undocumented ``timeout`` to various functions. Under Python 2, the previously undocumented
parameter to ``Popen.communicate`` raises an exception like its ``timeout`` parameter to :meth:`Popen.communicate
<gevent.subprocess.Popen.communicate>` raises an exception like its
Python 3 counterpart. Python 3 counterpart.
- An exception starting a child process with the ``gevent.subprocess`` - An exception starting a child process with the :mod:`gevent.subprocess`
module no longer leaks file descriptors. Reported in :pr:`374` by 陈小玉. module no longer leaks file descriptors. Reported in :pr:`374` by 陈小玉.
- The example ``echoserver.py`` no longer binds to the standard X11 - The example ``echoserver.py`` no longer binds to the standard X11
TCP port. Reported in :issue:`485` by minusf. TCP port. Reported in :issue:`485` by minusf.
- ``gevent.iwait`` no longer throws ``LoopExit`` if the caller - :func:`gevent.iwait` no longer throws :exc:`~gevent.hub.LoopExit` if the caller
switches greenlets between return values. Reported and initial patch switches greenlets between return values. Reported and initial patch
in :pr:`467` by Alexey Borzenkov. in :issue:`467` by Alexey Borzenkov.
- The default threadpool and default threaded resolver work in a - The default threadpool and default threaded resolver work in a
forked child process, such as with ``multiprocessing.Process``. forked child process, such as with :class:`multiprocessing.Process`.
Previously the child process would hang indefinitely. Reported in Previously the child process would hang indefinitely. Reported in
:issue:`230` by Lx Yu. :issue:`230` by Lx Yu.
- Fork watchers are more likely to (eventually) get called in a - Fork watchers are more likely to (eventually) get called in a
multi-threaded program (except on Windows). See :issue:`154`. multi-threaded program (except on Windows). See :issue:`154`.
- ``gevent.killall`` accepts an arbitrary iterable for the greenlets - :func:`gevent.killall` accepts an arbitrary iterable for the greenlets
to kill. Reported in :issue:`404` by Martin Bachwerk; seen in to kill. Reported in :issue:`404` by Martin Bachwerk; seen in
combination with older versions of simple-requests. combination with older versions of simple-requests.
- ``gevent.local.local`` objects are now eligible for garbage - :class:`gevent.local.local` objects are now eligible for garbage
collection as soon as the greenlet finishes running, matching the collection as soon as the greenlet finishes running, matching the
behaviour of the built-in ``threading.local`` (when implemented behaviour of the built-in :class:`threading.local` (when implemented
natively). Reported in :issue:`387` by AusIV. natively). Reported in :issue:`387` by AusIV.
- Killing a greenlet (with ``gevent.kill`` or - Killing a greenlet (with :func:`gevent.kill` or
``gevent.greenlet.Greenlet.kill``) before it is actually started and :meth:`gevent.Greenlet.kill`) before it is actually started and
switched to now prevents the greenlet from ever running, instead of switched to now prevents the greenlet from ever running, instead of
raising an exception when it is later switched to. See :issue:`330` raising an exception when it is later switched to. See :issue:`330`
reported by Jonathan Kamens. reported by Jonathan Kamens.
...@@ -455,9 +466,9 @@ ...@@ -455,9 +466,9 @@
you'll need a very recent PyPy build including CFFI 1.2.0. you'll need a very recent PyPy build including CFFI 1.2.0.
- Drop support for Python 2.5. Python 2.5 users can continue to use - Drop support for Python 2.5. Python 2.5 users can continue to use
gevent 1.0.x. gevent 1.0.x.
- Fix ``gevent.greenlet.joinall`` to not ignore ``count`` when - Fix :func:`gevent.joinall` to not ignore ``count`` when
``raise_error`` is False. See :pr:`512` by Ivan Diao. ``raise_error`` is False. See :pr:`512` by Ivan Diao.
- Fix ``subprocess.Popen`` to not ignore the ``bufsize`` argument. Note - Fix :class:`gevent.subprocess.Popen` to not ignore the ``bufsize`` argument. Note
that this changes the (platform dependent) default, typically from that this changes the (platform dependent) default, typically from
buffered to unbuffered. See :pr:`542` by Romuald Brunet. buffered to unbuffered. See :pr:`542` by Romuald Brunet.
- Upgraded c-ares to 1.10.0. See :pr:`579` by Omer Katz. - Upgraded c-ares to 1.10.0. See :pr:`579` by Omer Katz.
...@@ -467,9 +478,9 @@ ...@@ -467,9 +478,9 @@
and they may have to be modified (for example, ``CFLAGS`` is no and they may have to be modified (for example, ``CFLAGS`` is no
longer allowed to include ``-I`` directives, which must instead be longer allowed to include ``-I`` directives, which must instead be
placed in ``CPPFLAGS``). placed in ``CPPFLAGS``).
- Add a ``count`` argument to ``gevent.greenlet.wait``. See :pr:`482` by - Add a ``count`` argument to :func:`gevent.iwait`. See :pr:`482` by
wiggin15. wiggin15.
- Add a ``timeout`` argument to ``gevent.queue.JoinableQueue.wait`` - Add a ``timeout`` argument to :meth:`gevent.queue.JoinableQueue.join`
which now returns whether all items were waited for or not. which now returns whether all items were waited for or not.
- ``gevent.queue.JoinableQueue`` treats ``items`` passed to - ``gevent.queue.JoinableQueue`` treats ``items`` passed to
``__init__`` as unfinished tasks, the same as if they were ``put``. ``__init__`` as unfinished tasks, the same as if they were ``put``.
......
...@@ -25,4 +25,8 @@ ...@@ -25,4 +25,8 @@
.. note:: As implemented, attempting to use .. note:: As implemented, attempting to use
:meth:`Threadpool.appy` from inside another function that :meth:`Threadpool.appy` from inside another function that
was itself spawned in a threadpool (any threadpool) will was itself spawned in a threadpool (any threadpool) will
cause the function to be run immediatesly. cause the function to be run immediately.
.. versionchanged:: 1.1a2
Now raises any exception raised by *func* instead of
dropping it.
...@@ -979,6 +979,10 @@ dl.glossary dt { ...@@ -979,6 +979,10 @@ dl.glossary dt {
margin: 0; margin: 0;
} }
th.field-name {
vertical-align: top;
}
.refcount { .refcount {
color: #060; color: #060;
} }
......
...@@ -163,6 +163,7 @@ include: ...@@ -163,6 +163,7 @@ include:
- Almost anywhere that gevent raises an exception from one greenlet to - Almost anywhere that gevent raises an exception from one greenlet to
another (e.g., :meth:`Greenlet.get <gevent.Greenlet.get>`), another (e.g., :meth:`Greenlet.get <gevent.Greenlet.get>`),
the original traceback is preserved and raised. the original traceback is preserved and raised.
- Various logging/debugging outputs have been cleaned up.
- The WSGI server found in :mod:`gevent.pywsgi` is more robust against - The WSGI server found in :mod:`gevent.pywsgi` is more robust against
errors in either the client or the WSGI application, fixing several errors in either the client or the WSGI application, fixing several
hangs or HTTP protocol violations. It also supports new hangs or HTTP protocol violations. It also supports new
......
...@@ -275,9 +275,15 @@ class FileObjectPosix(object): ...@@ -275,9 +275,15 @@ class FileObjectPosix(object):
return self.io.readlines(sizehint) return self.io.readlines(sizehint)
def readable(self): def readable(self):
"""
.. versionadded:: 1.1b2
"""
return self.io.readable() return self.io.readable()
def writable(self): def writable(self):
"""
.. versionadded:: 1.1b2
"""
return self.io.writable() return self.io.writable()
def seek(self, *args, **kwargs): def seek(self, *args, **kwargs):
......
...@@ -110,6 +110,11 @@ class FileObjectThread(object): ...@@ -110,6 +110,11 @@ class FileObjectThread(object):
return self.threadpool.apply(func, args, kwargs) return self.threadpool.apply(func, args, kwargs)
def close(self): def close(self):
"""
.. versionchanged:: 1.1b1
The file object is closed using the threadpool. Note that whether or
not this action is synchronous or asynchronous is not documented.
"""
fobj = self.io fobj = self.io
if fobj is None: if fobj is None:
return return
......
...@@ -127,7 +127,7 @@ class Greenlet(greenlet): ...@@ -127,7 +127,7 @@ class Greenlet(greenlet):
:keyword run: The callable object to run. If not given, this object's :keyword run: The callable object to run. If not given, this object's
`_run` method will be invoked (typically defined by subclasses). `_run` method will be invoked (typically defined by subclasses).
.. versionchanged:: 1.1a3 .. versionchanged:: 1.1b1
The ``run`` argument to the constructor is now verified to be a callable The ``run`` argument to the constructor is now verified to be a callable
object. Previously, passing a non-callable object would fail after the greenlet object. Previously, passing a non-callable object would fail after the greenlet
was spawned. was spawned.
...@@ -357,6 +357,10 @@ class Greenlet(greenlet): ...@@ -357,6 +357,10 @@ class Greenlet(greenlet):
This can be used as ``gevent.spawn`` or ``Greenlet.spawn``. This can be used as ``gevent.spawn`` or ``Greenlet.spawn``.
The arguments are passed to :meth:`Greenlet.__init__`. The arguments are passed to :meth:`Greenlet.__init__`.
.. versionchanged:: 1.1b1
If a *function* is given that is not callable, immediately raise a :exc:`TypeError`
instead of spawning a greenlet that will raise an uncaught TypeError.
""" """
g = cls(*args, **kwargs) g = cls(*args, **kwargs)
g.start() g.start()
...@@ -371,7 +375,7 @@ class Greenlet(greenlet): ...@@ -371,7 +375,7 @@ class Greenlet(greenlet):
The arguments are passed to :meth:`Greenlet.__init__`. The arguments are passed to :meth:`Greenlet.__init__`.
.. versionchanged:: 1.1a3 .. versionchanged:: 1.1b1
If an argument that's meant to be a function (the first argument in *args*, or the ``run`` keyword ) If an argument that's meant to be a function (the first argument in *args*, or the ``run`` keyword )
is given to this classmethod (and not a classmethod of a subclass), is given to this classmethod (and not a classmethod of a subclass),
it is verified to be callable. Previously, the spawned greenlet would have failed it is verified to be callable. Previously, the spawned greenlet would have failed
...@@ -655,7 +659,7 @@ def killall(greenlets, exception=GreenletExit, block=True, timeout=None): ...@@ -655,7 +659,7 @@ def killall(greenlets, exception=GreenletExit, block=True, timeout=None):
""" """
Forceably terminate all the ``greenlets`` by causing them to raise ``exception``. Forceably terminate all the ``greenlets`` by causing them to raise ``exception``.
:param greenlets: A bounded iterable of the non-None greenlets to terminate. :param greenlets: A **bounded** iterable of the non-None greenlets to terminate.
*All* the items in this iterable must be greenlets that belong to the same thread. *All* the items in this iterable must be greenlets that belong to the same thread.
:keyword exception: The exception to raise in the greenlets. By default this is :keyword exception: The exception to raise in the greenlets. By default this is
:class:`GreenletExit`. :class:`GreenletExit`.
...@@ -667,8 +671,12 @@ def killall(greenlets, exception=GreenletExit, block=True, timeout=None): ...@@ -667,8 +671,12 @@ def killall(greenlets, exception=GreenletExit, block=True, timeout=None):
the exception asynchronously. the exception asynchronously.
:keyword float timeout: A time in seconds to wait for greenlets to die. If given, it is :keyword float timeout: A time in seconds to wait for greenlets to die. If given, it is
only honored when ``block`` is True. only honored when ``block`` is True.
:raises Timeout: If blocking and a timeout is given that elapses before :raise Timeout: If blocking and a timeout is given that elapses before
all the greenlets are dead. all the greenlets are dead.
.. versionchanged:: 1.1a2
*greenlets* can be any iterable of greenlets, like an iterator or a set.
Previously it had to be a list or tuple.
""" """
# support non-indexable containers like iterators or set objects # support non-indexable containers like iterators or set objects
greenlets = list(greenlets) greenlets = list(greenlets)
......
...@@ -134,6 +134,10 @@ def spawn_raw(function, *args, **kwargs): ...@@ -134,6 +134,10 @@ def spawn_raw(function, *args, **kwargs):
occasionally be useful as an optimization if there are many occasionally be useful as an optimization if there are many
greenlets involved. greenlets involved.
.. versionchanged:: 1.1b1
If *function* is not callable, immediately raise a :exc:`TypeError`
instead of spawning a greenlet that will raise an uncaught TypeError.
.. versionchanged:: 1.1rc2 .. versionchanged:: 1.1rc2
Accept keyword arguments for ``function`` as previously (incorrectly) Accept keyword arguments for ``function`` as previously (incorrectly)
documented. Note that this may incur an additional expense. documented. Note that this may incur an additional expense.
...@@ -929,6 +933,12 @@ def iwait(objects, timeout=None, count=None): ...@@ -929,6 +933,12 @@ def iwait(objects, timeout=None, count=None):
are available, then this method returns immediately. are available, then this method returns immediately.
.. seealso:: :func:`wait` .. seealso:: :func:`wait`
.. versionchanged:: 1.1a1
Add the *count* parameter.
.. versionchanged:: 1.1a2
No longer raise :exc:`LoopExit` if our caller switches greenlets
in between items yielded by this function.
""" """
# QQQ would be nice to support iterable here that can be generated slowly (why?) # QQQ would be nice to support iterable here that can be generated slowly (why?)
if objects is None: if objects is None:
......
...@@ -127,6 +127,12 @@ affects what we see: ...@@ -127,6 +127,12 @@ affects what we see:
11 11
>>> del mydata >>> del mydata
.. versionchanged:: 1.1a2
Update the implementation to match Python 3.4 instead of Python 2.5.
This results in locals being eligible for garbage collection as soon
as their greenlet exits.
""" """
from copy import copy from copy import copy
...@@ -225,6 +231,9 @@ def _patch(self): ...@@ -225,6 +231,9 @@ def _patch(self):
class local(object): class local(object):
"""
An object whose attributes are greenlet-local.
"""
__slots__ = '_local__impl', '__dict__' __slots__ = '_local__impl', '__dict__'
def __new__(cls, *args, **kw): def __new__(cls, *args, **kw):
......
...@@ -171,8 +171,12 @@ class DummySemaphore(object): ...@@ -171,8 +171,12 @@ class DummySemaphore(object):
pass pass
def acquire(self, blocking=True, timeout=None): def acquire(self, blocking=True, timeout=None):
"""A DummySemaphore can always be acquired immediately so this always """
A DummySemaphore can always be acquired immediately so this always
returns True and ignores its arguments. returns True and ignores its arguments.
.. versionchanged:: 1.1a1
Always return *true*.
""" """
return True return True
......
...@@ -269,6 +269,9 @@ def patch_thread(threading=True, _threading_local=True, Event=False, logging=Tru ...@@ -269,6 +269,9 @@ def patch_thread(threading=True, _threading_local=True, Event=False, logging=Tru
:class:`multiprocessing.Queue` or :class:`multiprocessing.Queue` or
:class:`concurrent.futures.ProcessPoolExecutor` (which uses a :class:`concurrent.futures.ProcessPoolExecutor` (which uses a
``Queue``) will hang the process. ``Queue``) will hang the process.
.. versionchanged:: 1.1b1
Add *logging* and *existing_locks* params.
""" """
# Description of the hang: # Description of the hang:
# There is an incompatibility with patching 'thread' and the 'multiprocessing' module: # There is an incompatibility with patching 'thread' and the 'multiprocessing' module:
......
...@@ -264,7 +264,7 @@ if hasattr(os, 'fork'): ...@@ -264,7 +264,7 @@ if hasattr(os, 'fork'):
Availability: POSIX. Availability: POSIX.
.. versionadded:: 1.1a3 .. versionadded:: 1.1b1
""" """
# XXX Does not handle tracing children # XXX Does not handle tracing children
if pid <= 0: if pid <= 0:
...@@ -329,7 +329,7 @@ if hasattr(os, 'fork'): ...@@ -329,7 +329,7 @@ if hasattr(os, 'fork'):
Pass the builtin :func:`os.fork` function if you do not need to Pass the builtin :func:`os.fork` function if you do not need to
initialize gevent in the child process. initialize gevent in the child process.
.. versionadded:: 1.1a3 .. versionadded:: 1.1b1
.. seealso:: .. seealso::
:func:`gevent.monkey.get_original` To access the builtin :func:`os.fork`. :func:`gevent.monkey.get_original` To access the builtin :func:`os.fork`.
""" """
......
...@@ -365,6 +365,8 @@ class GroupMappingMixin(object): ...@@ -365,6 +365,8 @@ class GroupMappingMixin(object):
.. versionchanged:: 1.1b3 .. versionchanged:: 1.1b3
Added the *maxsize* keyword parameter. Added the *maxsize* keyword parameter.
.. versionchanged:: 1.1a1
Accept multiple *iterables* to iterate in parallel.
""" """
return self.__imap(IMap, func, *iterables, **kwargs) return self.__imap(IMap, func, *iterables, **kwargs)
......
...@@ -742,7 +742,12 @@ class WSGIHandler(object): ...@@ -742,7 +742,12 @@ class WSGIHandler(object):
self._sendall(towrite) self._sendall(towrite)
def start_response(self, status, headers, exc_info=None): def start_response(self, status, headers, exc_info=None):
# .. versionchanged:: 1.1b5 handle header/status encoding here """
.. versionchanged:: 1.1b5
Pro-actively handle checking the encoding of the status line
and headers during this method. On Python 2, avoid some
extra encodings.
"""
if exc_info: if exc_info:
try: try:
if self.headers_sent: if self.headers_sent:
......
...@@ -59,7 +59,7 @@ class Queue(object): ...@@ -59,7 +59,7 @@ class Queue(object):
size is infinite. size is infinite.
.. versionchanged:: 1.1b3 .. versionchanged:: 1.1b3
Queue's now support :func:`len`; it behaves the same as :meth:`qsize`. Queues now support :func:`len`; it behaves the same as :meth:`qsize`.
.. versionchanged:: 1.1b3 .. versionchanged:: 1.1b3
Multiple greenlets that block on a call to :meth:`put` for a full queue Multiple greenlets that block on a call to :meth:`put` for a full queue
will now be woken up to put their items into the queue in the order in which will now be woken up to put their items into the queue in the order in which
...@@ -404,9 +404,19 @@ class LifoQueue(Queue): ...@@ -404,9 +404,19 @@ class LifoQueue(Queue):
class JoinableQueue(Queue): class JoinableQueue(Queue):
'''A subclass of :class:`Queue` that additionally has :meth:`task_done` and :meth:`join` methods.''' """
A subclass of :class:`Queue` that additionally has
:meth:`task_done` and :meth:`join` methods.
"""
def __init__(self, maxsize=None, items=None, unfinished_tasks=None): def __init__(self, maxsize=None, items=None, unfinished_tasks=None):
"""
.. versionchanged:: 1.1a1
If *unfinished_tasks* is not given, then all the given *items*
(if any) will be considered unfinished.
"""
from gevent.event import Event from gevent.event import Event
Queue.__init__(self, maxsize, items) Queue.__init__(self, maxsize, items)
self._cond = Event() self._cond = Event()
...@@ -454,7 +464,8 @@ class JoinableQueue(Queue): ...@@ -454,7 +464,8 @@ class JoinableQueue(Queue):
self._cond.set() self._cond.set()
def join(self, timeout=None): def join(self, timeout=None):
'''Block until all items in the queue have been gotten and processed. '''
Block until all items in the queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the queue. The count of unfinished tasks goes up whenever an item is added to the queue.
The count goes down whenever a consumer thread calls :meth:`task_done` to indicate The count goes down whenever a consumer thread calls :meth:`task_done` to indicate
...@@ -465,6 +476,9 @@ class JoinableQueue(Queue): ...@@ -465,6 +476,9 @@ class JoinableQueue(Queue):
for all tasks to finish. for all tasks to finish.
:return: ``True`` if all tasks have finished; if ``timeout`` was given and expired before :return: ``True`` if all tasks have finished; if ``timeout`` was given and expired before
all tasks finished, ``False``. all tasks finished, ``False``.
.. versionchanged:: 1.1a1
Add the *timeout* parameter.
''' '''
return self._cond.wait(timeout=timeout) return self._cond.wait(timeout=timeout)
......
...@@ -66,6 +66,10 @@ def signal(signalnum, handler): ...@@ -66,6 +66,10 @@ def signal(signalnum, handler):
Use of ``SIG_IGN`` and ``SIG_DFL`` may also have race conditions Use of ``SIG_IGN`` and ``SIG_DFL`` may also have race conditions
with libev child watchers and the :mod:`gevent.subprocess` module. with libev child watchers and the :mod:`gevent.subprocess` module.
.. versionchanged:: 1.1rc2
Allow using ``SIG_IGN`` and ``SIG_DFL`` to reset and ignore ``SIGCHLD``.
However, this allows the possibility of a race condition.
""" """
if signalnum != _signal.SIGCHLD: if signalnum != _signal.SIGCHLD:
return _signal_signal(signalnum, handler) return _signal_signal(signalnum, handler)
......
...@@ -347,7 +347,13 @@ class Popen(object): ...@@ -347,7 +347,13 @@ class Popen(object):
cwd=None, env=None, universal_newlines=False, cwd=None, env=None, universal_newlines=False,
startupinfo=None, creationflags=0, threadpool=None, startupinfo=None, creationflags=0, threadpool=None,
**kwargs): **kwargs):
"""Create new Popen instance.""" """Create new Popen instance.
:param kwargs: *Only* allowed under Python 3; under Python 2, any
unrecognized keyword arguments will result in a :exc:`TypeError`.
Under Python 3, keyword arguments can include ``pass_fds``, ``start_new_session``,
and ``restore_signals``.
"""
if not PY3 and kwargs: if not PY3 and kwargs:
raise TypeError("Got unexpected keyword arguments", kwargs) raise TypeError("Got unexpected keyword arguments", kwargs)
...@@ -562,6 +568,13 @@ class Popen(object): ...@@ -562,6 +568,13 @@ class Popen(object):
:keyword timeout: Under Python 2, this is a gevent extension; if :keyword timeout: Under Python 2, this is a gevent extension; if
given and it expires, we will raise :class:`gevent.timeout.Timeout`. given and it expires, we will raise :class:`gevent.timeout.Timeout`.
Under Python 3, this raises the standard :exc:`TimeoutExpired` exception. Under Python 3, this raises the standard :exc:`TimeoutExpired` exception.
.. versionchanged:: 1.1a2
Under Python 2, if the *timeout* elapses, raise the :exc:`gevent.timeout.Timeout`
exception. Previously, we silently returned.
.. versionchanged:: 1.1b5
Honor a *timeout* even if there's no way to communicate with the child
(stdin, stdout, and stderr are not pipes).
""" """
greenlets = [] greenlets = []
if self.stdin: if self.stdin:
...@@ -649,6 +662,7 @@ class Popen(object): ...@@ -649,6 +662,7 @@ class Popen(object):
None if stderr is None else stderr_value or b'') None if stderr is None else stderr_value or b'')
def poll(self): def poll(self):
"""Check if child process has terminated. Set and return :attr:`returncode` attribute."""
return self._internal_poll() return self._internal_poll()
if PY3: if PY3:
...@@ -927,6 +941,7 @@ class Popen(object): ...@@ -927,6 +941,7 @@ class Popen(object):
# #
def rawlink(self, callback): def rawlink(self, callback):
# Not public documented, part of the link protocol
self.result.rawlink(linkproxy(callback, self)) self.result.rawlink(linkproxy(callback, self))
# XXX unlink # XXX unlink
...@@ -1258,7 +1273,7 @@ class Popen(object): ...@@ -1258,7 +1273,7 @@ class Popen(object):
return self.returncode return self.returncode
def wait(self, timeout=None): def wait(self, timeout=None):
"""Wait for child process to terminate. Returns returncode """Wait for child process to terminate. Returns :attr:`returncode`
attribute. attribute.
:keyword timeout: The floating point number of seconds to wait. :keyword timeout: The floating point number of seconds to wait.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment