Changelog History
Page 2
-
v20.6.1 Changes
June 10, 2020π Features
- β¬οΈ gevent's CI is now tested on Ubuntu 18.04 (Bionic), an upgrade from
16.04 (Xenial).
See :issue:
1623
.
π Bugfixes
- On Python 2, the dnspython resolver can be used without having
selectors2 installed. Previously, an ImportError would be raised.
See :issue:
issue1641
. - Python 3
gevent.ssl.SSLSocket
objects no longer attempt to catchConnectionResetError
and treat it the same as anSSLError
withSSL_ERROR_EOF
(typically by suppressing it).
This was a difference from the way the standard library behaved (which is to raise the exception). It was added to gevent during early testing of OpenSSL 1.1 and TLS 1.3. See :issue:
1637
.
- β¬οΈ gevent's CI is now tested on Ubuntu 18.04 (Bionic), an upgrade from
16.04 (Xenial).
See :issue:
-
v20.6.0 Changes
June 06, 2020π Features
- β Add
gevent.selectors
containingGeventSelector
. This selector implementation uses gevent details to attempt to reduce overhead when polling many file descriptors, only some of which become ready at any given time.
This is monkey-patched as
selectors.DefaultSelector
by default.This is available on Python 2 if the
selectors2
backport is installed. (This backport is installed automatically using therecommended
extra.) When monkey-patching,selectors
is made available as an alias to this module. See :issue:1532
.- Depend on greenlet >= 0.4.16. This is required for CPython 3.9 and 3.10a0.
See :issue:
1627
. - β Add support for Python 3.9.
No binary wheels are available yet, however. See :issue:
1628
.π Bugfixes
gevent.socket.create_connection
andgevent.socket.socket.connect
no longer ignore IPv6 scope IDs.
Any IP address (IPv4 or IPv6) is no longer subject to an extra call to
getaddrinfo
. Depending on the resolver in use, this is likely to change the number and order of greenlet switches. (On Windows, in particular test cases when there are no other greenlets running, it has been observed to lead toLoopExit
in scenarios that didn't produce that before.) See :issue:1634
.
- β Add
-
v20.5.2 Changes
May 28, 2020π Bugfixes
- Forking a process that had use the threadpool to run tasks that
created their own hub would fail to clean up the threadpool by raising
greenlet.error
. See :issue:1631
.
- Forking a process that had use the threadpool to run tasks that
created their own hub would fail to clean up the threadpool by raising
-
v20.5.1 Changes
May 26, 2020π Features
- Waiters on Event and Semaphore objects that call
wait()
oracquire()
, respectively, that find the Event already set, or the Semaphore available, no longer "cut in line" and run before any previously scheduled greenlets. They now run in the order in which they arrived, just as waiters that had to block in those methods do. See :issue:1520
. - β‘οΈ Update tested PyPy version from 7.3.0 to 7.3.1 on Linux.
See :issue:
1569
. - π Make
zope.interface
,zope.event
and (by extension)setuptools
required dependencies. Theevents
install extra now does nothing and will be removed in 2021. See :issue:1619
. - β‘οΈ Update bundled libuv from 1.36.0 to 1.38.0.
See :issue:
1621
. - β‘οΈ Update bundled c-ares from 1.16.0 to 1.16.1.
On macOS, stop trying to adjust c-ares headers to make them universal. See :issue:
1624
.π Bugfixes
- π Make gevent locks that are monkey-patched usually work across native
threads as well as across greenlets within a single thread. Locks that
are only used in a single thread do not take a performance hit. While
cross-thread locking is relatively expensive, and not a recommended
programming pattern, it can happen unwittingly, for example when
using the threadpool and
logging
.
Before, cross-thread lock uses might succeed, or, if the lock was contended, raise
greenlet.error
. Now, in the contended case, if the lock has been acquired by the main thread at least once, it should correctly block in any thread, cooperating with the event loop of both threads. In certain (hopefully rare) cases, it might be possible for contended case to raiseLoopExit
when previously it would have raisedgreenlet.error
; if these cases are a practical concern, please open an issue.Also, the underlying Semaphore always behaves in an atomic fashion (as if the GIL was not released) when PURE_PYTHON is set. Previously, it only correctly did so on PyPy. See :issue:
issue1437
.- π Rename gevent's C accelerator extension modules using a prefix to
avoid clashing with other C extensions.
See :issue:
1480
. - Using
gevent.wait
on anEvent
more than once, when that Event is already set, could previously raise an AssertionError.
As part of this, exceptions raised in the main greenlet will now include a more complete traceback from the failing greenlet. See :issue:
1540
.- Avoid closing the same Python libuv watcher IO object twice. Under
some circumstances (only seen on Windows), that could lead to program
crashes.
See :issue:
1587
. - gevent can now be built using Cython 3.0a5 and newer. The PyPI distribution uses this version.
The libev extension was incompatible with this. As part of this, certain internal, undocumented names have been changed.
(Technically, gevent can be built with Cython 3.0a2 and above. However, up through 3.0a4 compiling with Cython 3 results in gevent's test for memory leaks failing. See
this Cython issue <https://github.com/cython/cython/issues/3578>
_.) See :issue:1599
.- Destroying a hub after joining it didn't necessarily clean up all resources associated with the hub, especially if the hub had been created in a secondary thread that was exiting. The hub and its parent greenlet could be kept alive.
Now, destroying a hub drops the reference to the hub and ensures it cannot be switched to again. (Though using a new blocking API call may still create a new hub.)
Joining a hub also cleans up some (small) memory resources that might have stuck around for longer before as well. See :issue:
1601
.- π Fix some potential crashes under libuv when using
gevent.signal_handler
. The crashes were seen running the test suite and were non-deterministic. See :issue:1606
.
- Waiters on Event and Semaphore objects that call
-
v20.5.0 Changes
May 01, 2020π Features
- β‘οΈ Update bundled c-ares to version 1.16.0.
Changes <https://c-ares.haxx.se/changelog.html>
_. See :issue:1588
. - β‘οΈ Update all the bundled
config.guess
andconfig.sub
scripts. See :issue:1589
. - β‘οΈ Update bundled libuv from 1.34.0 to 1.36.0.
See :issue:
1597
.
π Bugfixes
- π Use
ares_getaddrinfo
instead of a manual lookup.
This requires c-ares 1.16.0.
Note that this may change the results, in particular their order.
As part of this, certain parts of the c-ares extension were adapted to use modern Cython idioms.
A few minor errors and discrepancies were fixed as well, such as
gethostbyaddr('localhost')
working on Python 3 and failing on Python 2. The DNSpython resolver now raises the expected TypeError in more cases instead of an AttributeError. See :issue:1012
.- The c-ares and DNSPython resolvers now raise exceptions much more consistently with the standard resolver. Types and errnos are substantially more likely to match what the standard library produces.
Depending on the system and configuration, results may not match exactly, at least with DNSPython. There are still some rare cases where the system resolver can raise
herror
but DNSPython will raisegaierror
or vice versa. There doesn't seem to be a deterministic way to account for this. On PyPy,getnameinfo
can produce results when CPython raisessocket.error
, and gevent's DNSPython resolver also raisessocket.error
.In addition, several other small discrepancies were addressed, including handling of localhost and broadcast host names.
.. note:: This has been tested on Linux (CentOS and Ubuntu), macOS, and Windows. It hasn't been tested on other platforms, so results are unknown for them. The c-ares support, in particular, is using some additional socket functions and defines. Please let the maintainers know if this introduces issues.
See :issue:
1459
.
- β‘οΈ Update bundled c-ares to version 1.16.0.
-
v20.04.0 Changes
April 22, 2020π Features
- π Let CI (Travis and Appveyor) build and upload release wheels for
Windows, macOS and manylinux. As part of this, (a subset of) gevent's
tests can run if the standard library's
test.support
module has been stripped. See :issue:1555
. - β‘οΈ Update tested PyPy version from 7.2.0 on Windows to 7.3.1.
See :issue:
1569
.
π Bugfixes
- π Fix a spurious warning about watchers and resource leaks on libuv on
Windows. Reported by StΓ©phane Rainville.
See :issue:
1564
. - π Make monkey-patching properly remove
select.epoll
andselect.kqueue
. Reported by Kirill Smelkov. See :issue:1570
. - π Make it possible to monkey-patch :mod:
contextvars
before Python 3.7 if a non-standard backport that uses the same name as the standard library does is installed. Previously this would raise an error. Reported by Simon Davy. See :issue:1572
. - π Fix destroying the libuv default loop and then using the default loop
again.
See :issue:
1580
. - libuv loops that have watched children can now exit. Previously, the
SIGCHLD watcher kept the loop alive even if there were no longer any
watched children.
See :issue:
1581
.
π Deprecations and Removals
- PyPy no longer uses the Python allocation functions for libuv and
libev allocations.
See :issue:
1569
.
Misc
- π See :issue:
1367
.
- π Let CI (Travis and Appveyor) build and upload release wheels for
Windows, macOS and manylinux. As part of this, (a subset of) gevent's
tests can run if the standard library's
-
v1.5.0 Changes
April 10, 2020- β± Make
gevent.lock.RLock.acquire
accept the timeout parameter. - π Fix an
AttributeError
when wrapping gevent'sFileObject
around an opened text stream. Reported in :issue:1542
by dmrlawson. - π Fix compilation of libuv on AIX and Solaris 10. See :pr:
1549
and :pr:1548
by Arnon Yaari.
- β± Make
-
v1.5.a4 Changes
March 23, 2020β‘οΈ Platform and Packaging Updates
β‘οΈ Python version updates: gevent is now tested with CPython 3.6.10, 3.7.7 and 3.8.2. It is also tested with PyPy2 7.3 and PyPy 3.6 7.3.
The include directories used to compile the C extensions have been tweaked with the intent of making it easier to use older debug versions of Python. See :issue:
1461
.π¦ The binary wheels and installed package no longer include generated C source files and headers. Also excluded are Cython .pxd files, which were never documented. Please file an issue if you miss these.
β‘οΈ Library and Dependency Updates
- β‘οΈ Upgrade libev from 4.25 to 4.31 and update its embedded
config.guess
to the latest. See :issue:1504
.
.. important::
libev, when built with ``EV_VERIFY >= 2``, now performs verification of file descriptors when IO watchers are started *and* when they are stopped. If you first close a file descriptor and only then stop an associated watcher, libev will abort the process. Using the standard gevent socket and file objects handles this automatically, but if you're using the IO watchers directly, you'll need to watch out for this. The binary wheels gevent distributes *do not* set ``EV_VERIFY`` and don't have this issue.
π Make libuv and libev use the Python memory allocators. This assists with debugging. The event libraries allocate small amounts of memory at startup. The allocation functions have to take the GIL, but because of the limited amount of actual allocation that gets done this is not expected to be a bottleneck.
π Update the bundled
tblib
library to the unreleased 1.7.0 version. The only change is to add more attributes toFrame
andCode
objects for pytest compatibility. See :pr:1541
.
Potentially Breaking Changes
- β Remove the magic proxy object
gevent.signal
. This served as both a deprecated alias ofgevent.signal_handler
and the modulegevent.signal
. This made it confusing to humans and static analysis tools alike. The alias was deprecated since gevent 1.1b4. See :issue:1596
.
Other
π Make
gevent.subprocess.Popen.communicate
raise exceptions raised by reading from the process, like the standard library. In particular, under Python 3, if the process output is being decoded as text, this can now raiseUnicodeDecodeError
. Reported in :issue:1510
by Ofer Koren.π Make
gevent.subprocess.Popen.communicate
be more careful about closing files. Previously if a timeout error happened, a second call tocommunicate
might not close the pipe.β Add
gevent.contextvars
, a cooperative version ofcontextvars
. This is available to all Python versions. On Python 3.7 and above, wherecontextvars
is a standard library module, it is monkey-patched by default. See :issue:1407
.0οΈβ£ Use
selectors.PollSelector
as theselectors.DefaultSelector
after monkey-patching ifselect.poll
was defined. Previously, gevent replaced it withselectors.SelectSelector
, which has a different set of limitations (e.g., on certain platforms such as glibc Linux, it has a hardcoded limitation of only working with file descriptors < 1024). See :issue:1466
reported by Sam Wong.π Make the dnspython resolver work if dns python had been imported before the gevent resolver was initialized. Reported in :issue:
1526
by Chris Utz and Josh Zuech.
-
v1.5.a3 Changes
January 01, 2020β‘οΈ Python version updates: gevent is now tested with CPython 2.7.17, 3.5.9, 3.6.9, 3.7.5 and 3.8.0 (final). It is also tested with PyPy2 7.2 and PyPy 3.6 7.2
π Fix using monkey-patched
threading.Lock
andthreading.RLock
objects as spin locks by making them callsleep(0)
if they failed to acquire the lock in a non-blocking call. This lets other callbacks run to release the lock, simulating preemptive threading. Using spin locks is not recommended, but may have been done in code written for threads, especially on Python 3. See :issue:1464
.π Fix Semaphore (and monkey-patched threading locks) to be fair. This eliminates the rare potential for starvation of greenlets. As part of this change, the low-level method
rawlink
of Semaphore, Event, and AsyncResult now always remove the link object when calling it, sounlink
can sometimes be optimized out. See :issue:1487
.π Make
gevent.pywsgi
supportConnection: keep-alive
in HTTP/1.0. Based on :pr:1331
by tanchuhan.π Fix a potential crash using
gevent.idle()
when using libuv. See :issue:1489
.π Fix some potential crashes using libuv async watchers.
π Make
ThreadPool
consistently raiseInvalidThreadUseError
whenspawn
is called from a thread different than the thread that created the threadpool. This has never been allowed, but was inconsistently enforced. On gevent 1.3 and before, this would always raise "greenlet error: invalid thread switch," orLoopExit
. On gevent 1.4, it could raiseLoopExit
, depending on the number of tasks, but still, calling it from a different thread was likely to corrupt libev or libuv internals.β Remove some undocumented, deprecated functions from the threadpool module.
libuv: Fix a perceived slowness spawning many greenlets at the same time without yielding to the event loop while having no active IO watchers or timers. If the time spent launching greenlets exceeded the switch interval and there were no other active watchers, then the default IO poll time of about .3s would elapse between spawning batches. This could theoretically apply for any non-switching callbacks. This can be produced in synthetic benchmarks and other special circumstances, but real applications are unlikely to be affected. See :issue:
1493
.π Fix using the threadpool inside a script or module run with
python -m gevent.monkey
. Previously it would use greenlets instead of native threads. See :issue:1484
.π Fix potential crashes in the FFI backends if a watcher was closed and stopped in the middle of a callback from the event loop and then raised an exception. This could happen if the hub's
handle_error
function was poorly customized, for example. See :issue:1482
π Make
gevent.killall
stop greenlets from running that hadn't been run yet. This make it consistent withGreenlet.kill()
. See :issue:1473
reported by kochelmonster.π Make
gevent.spawn_raw
set theloop
attribute on returned greenlets. This lets them work with more gevent APIs, notablygevent.killall()
. They already had dictionaries, but this may make them slightly larger, depending on platform (on CPython 2.7 through 3.6 there is no apparent difference for one attribute but on CPython 3.7 and 3.8 dictionaries are initially empty and only allocate space once an attribute is added; they're still smaller than on earlier versions though).
File Object Changes
.. caution:: There may be breaking changes here for applications that relied on the old behaviour. The old behaviour was under specified and inconsistent and really only worked consistently with 'wb' and 'rb' modes, so most applications shouldn't be affected.
The file objects (
FileObjectPosix
,FileObjectThread
) now consistently support text and binary modes. If neither 'b' nor 't' is given in the mode, they will read and write native strings. If 't' is given, they will always work with unicode strings, and 'b' will always work with byte strings. (FileObjectPosix
already worked this way.) See :issue:1441
.The file objects accept encoding, errors and newline arguments. On Python 2, these are only used if 't' is in the mode.
0οΈβ£ The default mode for
FileObjectPosix
changed fromrb
to simplyr
, for consistency with the other file objects and the standardopen
and :func:io.open
functions.π Fix
FileObjectPosix
improperly being used from multiple greenlets. Previously this was hidden by forcing buffering, which raisedRuntimeError
.
-
v1.5.a2 Changes
October 21, 2019β Add support for CPython 3.8.0. (Windows wheels are not yet available.)
β‘οΈ Update to Cython 0.29.13 and cffi 1.12.3.
β Add an
--module
option togevent.monkey
allowing to run a Python module rather than a script. See :pr:1440
.π Improve the way joining the main thread works on Python 3.
Implement
SSLSocket.verify_client_post_handshake()
when available.π Fix tests when TLS1.3 is supported.
Disable Nagle's algorithm in the backdoor server. This can improve interactive response time.
β Test on Python 3.7.4. There are important SSL test fixes.