Commit b23342ce authored by Jason Madden's avatar Jason Madden

Wordsmithing CHANGES and iwait docstring.

parent 8307ddfe
...@@ -7,21 +7,21 @@ ...@@ -7,21 +7,21 @@
1.4.0 (unreleased) 1.4.0 (unreleased)
================== ==================
- Build with Cython 0.29 in '3str' mode.
- Add support for application-wide callbacks when ``Greenlet`` objects - Add support for application-wide callbacks when ``Greenlet`` objects
are started. See :pr:`1289`, provided by Yury Selivanov. are started. See :pr:`1289`, provided by Yury Selivanov.
- It is now possible to consume ready objects using `next(gevent.iwait(objs))`. - Fix consuming a single ready object using
Previously such a construction would hang. See :pr:`1288`, provided by Josh ``next(gevent.iwait(objs))``. Previously such a construction would
hang because `iter` was not called. See :pr:`1288`, provided by Josh
Snyder. This is not recommended, though, as unwaited objects will Snyder. This is not recommended, though, as unwaited objects will
have dangling links. have dangling links (but see next item).
- Build with Cython 0.29 in '3str' mode.
- There is new documentation on the possibility that `gevent.iwait` can produce - Make `gevent.iwait` return an iterator that can now also be used as
memory leaks when not fully consumed. To prevent such situations, a context manager. If you'll only be consuming part of the iterator,
`gevent.iwait` now provides optional contextmanager support, which will ensure use it in a ``with`` block to avoid leaking resources. See
that all resources are cleaned up. See :pr:`1290`, provided by Josh Snyder. :pr:`1290`, provided by Josh Snyder.
1.3.7 (2018-10-12) 1.3.7 (2018-10-12)
......
...@@ -180,10 +180,13 @@ def iwait_on_objects(objects, timeout=None, count=None): ...@@ -180,10 +180,13 @@ def iwait_on_objects(objects, timeout=None, count=None):
Iteratively yield *objects* as they are ready, until all (or *count*) are ready Iteratively yield *objects* as they are ready, until all (or *count*) are ready
or *timeout* expired. or *timeout* expired.
This function allocates resources which must be cleaned up. Consuming the If you will only be consuming a portion of the *objects*, you should
iterator until it is exhausted will automatically clean them up, and it is do so inside a ``with`` block on this object to avoid leaking resources::
also possible to use the returned object as a context manager to ensure
cleanup occurs. with gevent.iwait((a, b, c)) as it:
for i in it:
if i is a:
break
:param objects: A sequence (supporting :func:`len`) containing objects :param objects: A sequence (supporting :func:`len`) containing objects
implementing the wait protocol (rawlink() and unlink()). implementing the wait protocol (rawlink() and unlink()).
......
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