Commit 448127cd authored by Jason Madden's avatar Jason Madden

Preparing release 20.12.0

parent 56092924
...@@ -6,6 +6,99 @@ ...@@ -6,6 +6,99 @@
.. towncrier release notes start .. towncrier release notes start
20.12.0 (2020-12-22)
====================
Features
--------
- Make worker threads created by :class:`gevent.threadpool.ThreadPool` install
the :func:`threading.setprofile` and :func:`threading.settrace` hooks
while tasks are running. This provides visibility to profiling and
tracing tools like yappi.
Reported by Suhail Muhammed.
See :issue:`1678`.
Bugfixes
--------
- Incorrectly passing an exception *instance* instead of an exception
*type* to `gevent.Greenlet.kill` or `gevent.killall` no longer prints
an exception to stderr.
See :issue:`1663`.
- Make destroying a hub try harder to more forcibly stop loop processing
when there are outstanding callbacks or IO operations scheduled.
Thanks to Josh Snyder (:issue:`1686`) and Jan-Philip Gehrcke
(:issue:`1669`).
See :issue:`1686`.
- Improve the ability to use monkey-patched locks, and
`gevent.lock.BoundedSemaphore`, across threads, especially when the
various threads might not have a gevent hub or any other active
greenlets. In particular, this handles some cases that previously
raised ``LoopExit`` or would hang. Note that this may not be reliable
on PyPy on Windows; such an environment is not currently recommended.
The semaphore tries to avoid creating a hub if it seems unnecessary,
automatically creating one in the single-threaded case when it would
block, but not in the multi-threaded case. While the differences
should be correctly detected, it's possible there are corner cases
where they might not be.
If your application appears to hang acquiring semaphores, but adding a
call to ``gevent.get_hub()`` in the thread attempting to acquire the
semaphore before doing so fixes it, please file an issue.
See :issue:`1698`.
- Make error reporting when a greenlet suffers a `RecursionError` more
reliable.
Reported by Dan Milon.
See :issue:`1704`.
- gevent.pywsgi: Avoid printing an extra traceback ("TypeError: not
enough arguments for format string") to standard error on certain
invalid client requests.
Reported by Steven Grimm.
See :issue:`1708`.
- Add support for PyPy2 7.3.3.
See :issue:`1709`.
- Python 2: Make ``gevent.subprocess.Popen.stdin`` objects have a
``write`` method that guarantees to write the entire argument in
binary, unbuffered mode. This may require multiple trips around the
event loop, but more closely matches the behaviour of the Python 2
standard library (and gevent prior to 1.5). The number of bytes
written is still returned (instead of ``None``).
See :issue:`1711`.
- Make `gevent.pywsgi` trying to enforce the rules for reading chunked input or
``Content-Length`` terminated input when the connection is being
upgraded, for example to a websocket connection. Likewise, if the
protocol was switched by returning a ``101`` status, stop trying to
automatically chunk the responses.
Reported by Kavindu Santhusa.
See :issue:`1712`.
- Remove the ``__dict__`` attribute from `gevent.socket.socket` objects. The
standard library socket do not have a ``__dict__``.
Noticed by Carson Ip.
As part of this refactoring, share more common socket code between Python 2
and Python 3.
See :issue:`1724`.
Misc
----
- See :issue:`1692`.
----
20.9.0 (2020-09-22) 20.9.0 (2020-09-22)
=================== ===================
......
Incorrectly passing an exception *instance* instead of an exception
*type* to `gevent.Greenlet.kill` or `gevent.killall` no longer prints
an exception to stderr.
Make worker threads created by :class:`gevent.threadpool.ThreadPool` install
the :func:`threading.setprofile` and :func:`threading.settrace` hooks
while tasks are running. This provides visibility to profiling and
tracing tools like yappi.
Reported by Suhail Muhammed.
Make destroying a hub try harder to more forcibly stop loop processing
when there are outstanding callbacks or IO operations scheduled.
Thanks to Josh Snyder (:issue:`1686`) and Jan-Philip Gehrcke
(:issue:`1669`).
PyPy 7.3.2 (2.7 and 3.6) have been tested, and a small issue with 2.7
was corrected.
These are not yet tested on Travis CI.
.. note:: Support for Python 3.5 will be removed in 2021, as it has
now reached end-of-life.
Improve the ability to use monkey-patched locks, and
`gevent.lock.BoundedSemaphore`, across threads, especially when the
various threads might not have a gevent hub or any other active
greenlets. In particular, this handles some cases that previously
raised ``LoopExit`` or would hang. Note that this may not be reliable
on PyPy on Windows; such an environment is not currently recommended.
The semaphore tries to avoid creating a hub if it seems unnecessary,
automatically creating one in the single-threaded case when it would
block, but not in the multi-threaded case. While the differences
should be correctly detected, it's possible there are corner cases
where they might not be.
If your application appears to hang acquiring semaphores, but adding a
call to ``gevent.get_hub()`` in the thread attempting to acquire the
semaphore before doing so fixes it, please file an issue.
Make error reporting when a greenlet suffers a `RecursionError` more
reliable.
Reported by Dan Milon.
gevent.pywsgi: Avoid printing an extra traceback ("TypeError: not
enough arguments for format string") to standard error on certain
invalid client requests.
Reported by Steven Grimm.
Add support for PyPy2 7.3.3.
Python 2: Make ``gevent.subprocess.Popen.stdin`` objects have a
``write`` method that guarantees to write the entire argument in
binary, unbuffered mode. This may require multiple trips around the
event loop, but more closely matches the behaviour of the Python 2
standard library (and gevent prior to 1.5). The number of bytes
written is still returned (instead of ``None``).
Make `gevent.pywsgi` trying to enforce the rules for reading chunked input or
``Content-Length`` terminated input when the connection is being
upgraded, for example to a websocket connection. Likewise, if the
protocol was switched by returning a ``101`` status, stop trying to
automatically chunk the responses.
Reported by Kavindu Santhusa.
Remove the ``__dict__`` attribute from `gevent.socket.socket` objects. The
standard library socket do not have a ``__dict__``.
Noticed by Carson Ip.
As part of this refactoring, share more common socket code between Python 2
and Python 3.
...@@ -27,7 +27,7 @@ version_info = _version_info(20, 0, 0, 'dev', 0) # XXX: Remove me ...@@ -27,7 +27,7 @@ version_info = _version_info(20, 0, 0, 'dev', 0) # XXX: Remove me
#: Use ``pkg_resources.parse_version(__version__)`` or #: Use ``pkg_resources.parse_version(__version__)`` or
#: ``packaging.version.Version(__version__)`` to get a machine-usable #: ``packaging.version.Version(__version__)`` to get a machine-usable
#: value. #: value.
__version__ = '20.9.1.dev0' __version__ = '20.12.0'
__all__ = [ __all__ = [
......
...@@ -88,7 +88,7 @@ class WriteallMixin(object): ...@@ -88,7 +88,7 @@ class WriteallMixin(object):
Returns the length of *value*. Returns the length of *value*.
.. versionadded:: NEXT .. versionadded:: 20.12.0
""" """
# Do we need to play the same get_memory games we do with sockets? # Do we need to play the same get_memory games we do with sockets?
# And what about chunking for large values? See _socketcommon.py # And what about chunking for large values? See _socketcommon.py
......
...@@ -71,7 +71,7 @@ class Semaphore(AbstractLinkable): # pylint:disable=undefined-variable ...@@ -71,7 +71,7 @@ class Semaphore(AbstractLinkable): # pylint:disable=undefined-variable
.. versionchanged:: 1.5a3 .. versionchanged:: 1.5a3
The low-level ``rawlink`` method (most users won't use this) now automatically The low-level ``rawlink`` method (most users won't use this) now automatically
unlinks waiters before calling them. unlinks waiters before calling them.
.. versionchanged:: NEXT .. versionchanged:: 20.12.0
Improved support for multi-threaded usage. When multi-threaded usage is detected, Improved support for multi-threaded usage. When multi-threaded usage is detected,
instances will no longer create the thread's hub if it's not present. instances will no longer create the thread's hub if it's not present.
""" """
......
...@@ -42,7 +42,7 @@ class LoopExit(Exception): ...@@ -42,7 +42,7 @@ class LoopExit(Exception):
""" """
The (optional) hub that raised the error. The (optional) hub that raised the error.
.. versionadded:: NEXT .. versionadded:: 20.12.0
""" """
# XXX: Note that semaphore.py does this manually. # XXX: Note that semaphore.py does this manually.
if len(self.args) == 3: # From the hub if len(self.args) == 3: # From the hub
...@@ -128,7 +128,7 @@ class HubDestroyed(GreenletExit): ...@@ -128,7 +128,7 @@ class HubDestroyed(GreenletExit):
Clients outside of gevent must not raise this exception. Clients outside of gevent must not raise this exception.
.. versionadded:: NEXT .. versionadded:: 20.12.0
""" """
def __init__(self, destroy_loop): def __init__(self, destroy_loop):
......
...@@ -617,7 +617,7 @@ class Popen(object): ...@@ -617,7 +617,7 @@ class Popen(object):
were added to Python 3.9, but are available in any gevent version, provided were added to Python 3.9, but are available in any gevent version, provided
the underlying platform support is present. the underlying platform support is present.
.. versionchanged:: NEXT .. versionchanged:: 20.12.0
On Python 2 only, if unbuffered binary communication is requested, On Python 2 only, if unbuffered binary communication is requested,
the ``stdin`` attribute of this object will have a ``write`` method that the ``stdin`` attribute of this object will have a ``write`` method that
actually performs internal buffering and looping, similar to the standard library. actually performs internal buffering and looping, similar to the standard library.
......
...@@ -276,7 +276,7 @@ class ThreadPool(GroupMappingMixin): ...@@ -276,7 +276,7 @@ class ThreadPool(GroupMappingMixin):
.. versionchanged:: 1.5a3 .. versionchanged:: 1.5a3
The undocumented ``apply_e`` function, deprecated since 1.1, The undocumented ``apply_e`` function, deprecated since 1.1,
was removed. was removed.
.. versionchanged:: NEXT .. versionchanged:: 20.12.0
Install the profile and trace functions in the worker thread while Install the profile and trace functions in the worker thread while
the worker thread is running the supplied task. the worker thread is running the supplied task.
""" """
......
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