- Upgrade to 1.5a3:

- The file objects (FileObjectPosix, FileObjectThread) now
    consistently 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.
  - The default mode for FileObjectPosix changed from rb to
    simply r, for consistency with the other file objects and the
    standard open and io.open functions.
  - Fix FileObjectPosix improperly being used from multiple
    greenlets. Previously this was hidden by forcing buffering,
    which raised RuntimeError.
  - Fix using monkey-patched threading.Lock and threading.RLock
    objects as spin locks by making them call sleep(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, so unlink can
    sometimes be optimized out. See :issue:`1487`.
  - Make gevent.pywsgi support Connection: keep-alive in

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-gevent?expand=0&rev=61
This commit is contained in:
Matej Cepl 2020-01-02 16:30:27 +00:00 committed by Git OBS Bridge
parent 0bda9fef56
commit 2827e68802
6 changed files with 186 additions and 115 deletions

View File

@ -4,32 +4,23 @@ Subject: Fix failing tests
- ssl.OP_NO_COMPRESSION is set by default by ssl.
- thread_ident can be represented as a negative hex number now,
so replace the negative sign with the regex too, and not just the number.
Index: gevent-1.4.0/src/greentest/2.7/test_ssl.py
===================================================================
--- gevent-1.4.0.orig/src/greentest/2.7/test_ssl.py
+++ gevent-1.4.0/src/greentest/2.7/test_ssl.py
@@ -742,14 +742,14 @@ class ContextTests(unittest.TestCase):
--- a/src/greentest/2.7/test_ssl.py
+++ b/src/greentest/2.7/test_ssl.py
@@ -835,9 +835,10 @@ class ContextTests(unittest.TestCase):
def test_options(self):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
# OP_ALL | OP_NO_SSLv2 | OP_NO_SSLv3 is the default value
- self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3,
+ self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_COMPRESSION,
ctx.options)
ctx.options |= ssl.OP_NO_TLSv1
- self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_TLSv1,
+ self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_COMPRESSION | ssl.OP_NO_TLSv1,
ctx.options)
if can_clear_options():
ctx.options = (ctx.options & ~ssl.OP_NO_SSLv2) | ssl.OP_NO_TLSv1
- self.assertEqual(ssl.OP_ALL | ssl.OP_NO_TLSv1 | ssl.OP_NO_SSLv3,
+ self.assertEqual(ssl.OP_ALL | ssl.OP_NO_TLSv1 | ssl.OP_NO_SSLv3 | ssl.OP_NO_COMPRESSION,
ctx.options)
ctx.options = 0
self.assertEqual(0, ctx.options)
Index: gevent-1.4.0/src/gevent/tests/test__util.py
===================================================================
--- gevent-1.4.0.orig/src/gevent/tests/test__util.py
+++ gevent-1.4.0/src/gevent/tests/test__util.py
- default = (ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3)
+ default = (ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 |
+ OP_NO_COMPRESSION)
# SSLContext also enables these by default
- default |= (OP_NO_COMPRESSION | OP_CIPHER_SERVER_PREFERENCE |
+ default |= (OP_CIPHER_SERVER_PREFERENCE |
OP_SINGLE_DH_USE | OP_SINGLE_ECDH_USE |
OP_ENABLE_MIDDLEBOX_COMPAT)
self.assertEqual(default, ctx.options)
--- a/src/gevent/tests/test__util.py
+++ b/src/gevent/tests/test__util.py
@@ -134,7 +134,7 @@ class TestTree(greentest.TestCase):
def _normalize_tree_format(self, value):

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1eb7fa3b9bd9174dfe9c3b59b7a09b768ecd496debfc4976a9530a3e15c990d1
size 5169595

3
gevent-1.5a3.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f1a90da498d05fecc20fb13d4d8383704043fe1d386ebca97ebfc89747dad426
size 3878216

View File

@ -1,3 +1,158 @@
-------------------------------------------------------------------
Thu Jan 2 14:09:44 CET 2020 - Matej Cepl <mcepl@suse.com>
- Upgrade to 1.5a3:
- The file objects (FileObjectPosix, FileObjectThread) now
consistently 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.
- The default mode for FileObjectPosix changed from rb to
simply r, for consistency with the other file objects and the
standard open and io.open functions.
- Fix FileObjectPosix improperly being used from multiple
greenlets. Previously this was hidden by forcing buffering,
which raised RuntimeError.
- Fix using monkey-patched threading.Lock and threading.RLock
objects as spin locks by making them call sleep(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, so unlink can
sometimes be optimized out. See :issue:`1487`.
- Make gevent.pywsgi support Connection: 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 raise InvalidThreadUseError when
spawn 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," or
LoopExit. On gevent 1.4, it could raise LoopExit, 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 with Greenlet.kill().
See :issue:`1473` reported by kochelmonster.
- Make gevent.spawn_raw set the loop attribute on returned
greenlets. This lets them work with more gevent APIs, notably
gevent.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).
- Add support for CPython 3.8.0. (Windows wheels are not yet
available.)
- Add an --module option to gevent.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.
- Python version updates: gevent is now tested with CPython
2.7.16, 3.5.6, 3.6.8, and 3.7.2. It is also tested with PyPy2
7.1 and PyPy 3.6 7.1 (PyPy 7.0 and 7.1 were not capable of
running SSL tests on Travis CI).
- Support for Python 3.4 has been removed, as that version is
no longer supported uptstream.
- gevent binary wheels are now manylinux2010 and include libuv
support. pip 19 is needed to install them. See :issue:`1346`.
- gevent is now compiled with Cython 0.29.6 and cffi 1.12.2.
- gevent sources include a pyproject.toml file, specifying the
build requirements and enabling build isolation. pip 18 or
above is needed to take advantage of this. See :issue:`1180`.
- libev-cffi: Let the compiler fill in the definition of
nlink_t for st_nlink in struct stat, instead of trying to
guess it ourself. Reported in :issue:`1372` by Andreas
Schwab.
- Remove the Makefile. Its most useful commands, make clean and
make distclean, can now be accomplished in a cross-platform
way using python setup.py clean and python setup.py clean -a,
respectively. The remainder of the Makefile contained Travis
CI commands that have been moved to .travis.yml.
- Deprecate the EMBED and LIBEV_EMBED, etc, build-time
environment variables. Instead, use GEVENTSETUP_EMBED and
GEVENTSETUP_EMBED_LIBEV. See :issue:`1402`.
- The CFFI backends now respect the embed build-time setting.
This allows building the libuv backend without embedding
libuv (except on Windows).
- Support test resources. This allows disabling tests that use
the network. See :ref:`limiting-test-resource-usage` for
more.
- Python 3.7 subprocess: Copy a STARTUPINFO passed as
a parameter. Contributed by AndCycle in :pr:`1352`.
- subprocess: WIFSTOPPED and SIGCHLD are now handled for
determining Popen.returncode. See
https://bugs.python.org/issue29335
- subprocess: No longer close redirected FDs if they are in
pass_fds. This is a bugfix from Python 3.7 applied to all
versions gevent runs on.
- Fix certain operations on a Greenlet in an invalid state
(with an invalid parent) to raise a TypeError sooner rather
than an AttributeError later. This is also slightly faster on
CPython with Cython. Inspired by :issue:`1363` as reported by
Carson Ip. This means that some extreme corner cases that
might have passed by replacing a Greenlet's parent with
something that's not a gevent hub now no longer will.
- Fix: The spawning_stack for Greenlets on CPython should now
have correct line numbers in more cases. See :pr:`1379`.
- The result of gevent.ssl.SSLSocket.makefile() can be used as
a context manager on Python 2.
- Python 2: If the backport of the _thread_ module from futures
has already been imported at monkey-patch time, also patch
this module to be consistent. The pkg_resources package
imports this, and pkg_resources is often imported early on
Python 2 for namespace packages, so if futures is installed
this will likely be the case.
- Python 2: Avoid a memory leak when an io.BufferedWriter is
wrapped around a socket. Reported by Damien Tournoud in
:issue:`1318`.
- Avoid unbounded memory usage when creating very deep spawn
trees. Reported in :issue:`1371` by dmrlawson.
- Win: Make examples/process.py do something useful. See
:pr:`1378` by Robert Iannucci.
- Spawning greenlets can be up to 10% faster. See :pr:`1379`.
- Removed remove-testCongestion.patch which was subsumed in the
upstream tarball.
-------------------------------------------------------------------
Thu Apr 11 14:20:20 UTC 2019 - Matej Cepl <mcepl@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-gevent
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,18 +17,21 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define modversion 1.5a3
%define modname gevent
Name: python-gevent
Version: 1.4.0
Version: 1.5.0~a3
Release: 0
Summary: Python network library that uses greenlet and libevent
License: MIT
Group: Development/Languages/Python
URL: http://www.gevent.org/
Source: https://files.pythonhosted.org/packages/source/g/gevent/gevent-%{version}.tar.gz
# Source: https://files.pythonhosted.org/packages/source/g/gevent/gevent-%%{version}.tar.gz
Source0: https://github.com/gevent/%{modname}/archive/%{modversion}.tar.gz#/%{modname}-%{modversion}.tar.gz
Source100: %{name}-rpmlintrc
Patch0: remove-testCongestion.patch
Patch1: fix-tests.patch
Patch2: use-libev-cffi.patch
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module cffi}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module dnspython}
@ -89,8 +92,7 @@ BuildArch: noarch
Documentation and examples for %{name}.
%prep
%setup -q -n gevent-%{version}
%patch0 -p1
%setup -q -n gevent-%{modversion}
%patch1 -p1
%patch2 -p1
sed -i -e '1s!bin/env python!bin/python!' examples/*.py
@ -112,6 +114,7 @@ export CARES_EMBED=0
# test_ssl.py is fragile as it expect specific responses from ssl and
# does not account to our local changes
# Also, gh#gevent/gevent#1390
# Also, gh#gevent/gevent#1501
cat <<'EOF' >> network_tests.txt
test_urllib2net.py
test__server.py
@ -125,6 +128,10 @@ test_https.py
test_urllib2_localnet.py
test_ssl.py
test__ssl.py
test__select.py
test__close_backend_fd.py
test_httplib.py
test_wsgiref.py
EOF
export GEVENT_RESOLVER=thread
# Setting the TRAVIS environment variable makes some different configuration
@ -139,7 +146,7 @@ export LANG=en_US.UTF-8
%files %{python_files}
%doc AUTHORS README.rst TODO CHANGES.rst CONTRIBUTING.rst
%license LICENSE*
%{python_sitearch}/gevent-%{version}-py*.egg-info
%{python_sitearch}/gevent-%{modversion}-py*.egg-info
%{python_sitearch}/gevent/
%files -n python-gevent-doc

View File

@ -1,82 +0,0 @@
From: Antonio Larrosa <alarrosa@suse.com>
Subject: Remove testCongestion from test_socket.py
Remove testCongestion from test_socket.py which is failing with a timeout.
Index: gevent-1.4.0/src/greentest/3.7/test_socket.py
===================================================================
--- gevent-1.4.0.orig/src/greentest/3.7/test_socket.py
+++ gevent-1.4.0/src/greentest/3.7/test_socket.py
@@ -2054,34 +2054,6 @@ class RDSTest(ThreadedRDSSocketTest):
self.data = b'select'
self.cli.sendto(self.data, 0, (HOST, self.port))
- def testCongestion(self):
- # wait until the sender is done
- self.evt.wait()
-
- def _testCongestion(self):
- # test the behavior in case of congestion
- self.data = b'fill'
- self.cli.setblocking(False)
- try:
- # try to lower the receiver's socket buffer size
- self.cli.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 16384)
- except OSError:
- pass
- with self.assertRaises(OSError) as cm:
- try:
- # fill the receiver's socket buffer
- while True:
- self.cli.sendto(self.data, 0, (HOST, self.port))
- finally:
- # signal the receiver we're done
- self.evt.set()
- # sendto() should have failed with ENOBUFS
- self.assertEqual(cm.exception.errno, errno.ENOBUFS)
- # and we should have received a congestion notification through poll
- r, w, x = select.select([self.serv], [], [], 3.0)
- self.assertIn(self.serv, r)
-
-
@unittest.skipIf(fcntl is None, "need fcntl")
@unittest.skipUnless(HAVE_SOCKET_VSOCK,
'VSOCK sockets required for this test.')
Index: gevent-1.4.0/src/greentest/3.6/test_socket.py
===================================================================
--- gevent-1.4.0.orig/src/greentest/3.6/test_socket.py
+++ gevent-1.4.0/src/greentest/3.6/test_socket.py
@@ -1769,33 +1769,6 @@ class RDSTest(ThreadedRDSSocketTest):
self.data = b'select'
self.cli.sendto(self.data, 0, (HOST, self.port))
- def testCongestion(self):
- # wait until the sender is done
- self.evt.wait()
-
- def _testCongestion(self):
- # test the behavior in case of congestion
- self.data = b'fill'
- self.cli.setblocking(False)
- try:
- # try to lower the receiver's socket buffer size
- self.cli.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 16384)
- except OSError:
- pass
- with self.assertRaises(OSError) as cm:
- try:
- # fill the receiver's socket buffer
- while True:
- self.cli.sendto(self.data, 0, (HOST, self.port))
- finally:
- # signal the receiver we're done
- self.evt.set()
- # sendto() should have failed with ENOBUFS
- self.assertEqual(cm.exception.errno, errno.ENOBUFS)
- # and we should have received a congestion notification through poll
- r, w, x = select.select([self.serv], [], [], 3.0)
- self.assertIn(self.serv, r)
-
@unittest.skipUnless(thread, 'Threading required for this test.')
class BasicTCPTest(SocketConnectedTest):