Commit 43d48a84 authored by Jason Madden's avatar Jason Madden Committed by GitHub

Merge pull request #1676 from gevent/greenlet0417

Support and require greenlet 0.4.17
parents ca216c77 b6a596cd
......@@ -52,6 +52,7 @@ limit-inference-results=1
# Pylint 2.4 adds import-outside-toplevel. But we do that a lot to defer imports because of patching.
# Pylint 2.4 adds self-assigning-variable. But we do *that* to avoid unused-import when we
# "export" the variable and don't have a __all__.
# Pylint 2.6 adds some python-3-only things that don't apply
disable=wrong-import-position,
wrong-import-order,
missing-docstring,
......@@ -74,8 +75,9 @@ disable=wrong-import-position,
useless-return,
useless-object-inheritance,
import-outside-toplevel,
self-assigning-variable
self-assigning-variable,
raise-missing-from,
super-with-arguments
[FORMAT]
# duplicated from setup.cfg
......
......@@ -279,18 +279,20 @@ jobs:
- mkdir -p $HOME/.cache/pip
- chmod a+w $HOME/.cache/pip
- stage: test
name: 32-bit manylinux wheels (all Pythons)
language: python
services: docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux2010_i686 PRE_CMD=linux32
install: docker pull $DOCKER_IMAGE
script: bash scripts/releases/make-manylinux
before_script:
- python -mpip install -U pip twine
- chmod a+rwx $HOME/.cache
- mkdir -p $HOME/.cache/pip
- chmod a+rwx $HOME/.cache/pip
# 32-bit manylinux temporarily commentted out.
# https://github.com/cython/cython/issues/3840 has surfaced again.
# - stage: test
# name: 32-bit manylinux wheels (all Pythons)
# language: python
# services: docker
# env: DOCKER_IMAGE=quay.io/pypa/manylinux2010_i686 PRE_CMD=linux32
# install: docker pull $DOCKER_IMAGE
# script: bash scripts/releases/make-manylinux
# before_script:
# - python -mpip install -U pip twine
# - chmod a+rwx $HOME/.cache
# - mkdir -p $HOME/.cache/pip
# - chmod a+rwx $HOME/.cache/pip
# Lint the code. Because this is a separate job, even if it fails fast
# the tests will still run. Put it at the top for fast feedback.
......
......@@ -6,6 +6,42 @@
.. towncrier release notes start
20.6.3.dev0 (2020-09-22)
========================
Features
--------
- The embedded libev is now asked to detect the availability of
``clock_gettime`` and use the realtime and/or monotonic clocks, if
they are available.
On Linux, this can reduce the number of system calls libev makes.
Originally provided by Josh Snyder.
See :issue:`issue1648`.
Bugfixes
--------
- The ``DummyThread`` objects created automatically by certain
operations when the standard library threading module is
monkey-patched now match the naming convention the standard library
uses ("Dummy-12345"). Previously (since gevent 1.2a2) they used
"DummyThread-12345".
See :issue:`1659`.
- Fix compatibility with dnspython 2.
.. caution:: This currently means that it can be imported. But it
cannot yet be used. gevent has a pinned dependency on
dnspython < 2 for now.
See :issue:`1661`.
----
20.6.2 (2020-06-16)
===================
......
......@@ -11,12 +11,20 @@
extern "C" {
#endif
#define GREENLET_VERSION "0.4.16"
#define GREENLET_VERSION "0.4.17"
#if PY_VERSION_HEX >= 0x030700A3
# define GREENLET_USE_EXC_INFO
#endif
#ifndef GREENLET_USE_CONTEXT_VARS
#ifdef Py_CONTEXT_H
#define GREENLET_USE_CONTEXT_VARS 1
#else
#define GREENLET_USE_CONTEXT_VARS 0
#endif
#endif
typedef struct _greenlet {
PyObject_HEAD
char* stack_start;
......@@ -38,6 +46,9 @@ typedef struct _greenlet {
PyObject* exc_traceback;
#endif
PyObject* dict;
#if GREENLET_USE_CONTEXT_VARS
PyObject* context;
#endif
} PyGreenlet;
#define PyGreenlet_Check(op) PyObject_TypeCheck(op, &PyGreenlet_Type)
......
On CPython, depend on greenlet >= 0.4.17. This version is binary
incompatible with earlier releases on CPython 3.7 and later.
On Python 3.7 and above, the module ``gevent.contextvars`` is no
longer monkey-patched into the standard library. contextvars are now
both greenlet and asyncio task local. See :issue:`1656`.
......@@ -24,8 +24,9 @@ requires = [
# See version requirements in setup.py
"cffi >= 1.12.3 ; platform_python_implementation == 'CPython'",
# Python 3.7 requires at least 0.4.14, which is ABI incompatible with earlier
# releases. Python 3.9 and 3.10 require 0.4.16
"greenlet >= 0.4.16 ; platform_python_implementation == 'CPython'",
# releases. Python 3.9 and 3.10 require 0.4.16;
# 0.4.17 is ABI incompatible with earlier releases.
"greenlet >= 0.4.17 ; platform_python_implementation == 'CPython'",
]
[tool.towncrier]
......
......@@ -72,9 +72,9 @@ if [ -d /gevent -a -d /opt/python ]; then
# The downside is that we must install dependencies manually.
# NOTE: We can't upgrade ``wheel`` because ``auditwheel`` depends on
# it, and auditwheel is installed in one of these environments.
python -mpip install -U "cython >= 3.0a5" cffi greenlet setuptools
python -mpip install -U "cython >= 3.0a5" cffi 'greenlet >= 0.4.17' setuptools
time (python setup.py bdist_wheel -q > /dev/null)
PATH="$OPATH" auditwheel repair --plat manylinux2010_x86_64 dist/gevent*.whl
PATH="$OPATH" auditwheel repair dist/gevent*.whl
cp wheelhouse/gevent*.whl /gevent/wheelhouse
python -mpip install -U --no-compile `ls dist/gevent*whl`[test]
......@@ -106,5 +106,5 @@ echo Sharing ccache dir at $HOME/.ccache
if [ ! -d $HOME/.ccache ]; then
mkdir $HOME/.ccache
fi
docker run --rm -ti -v "$(pwd):/gevent" -v "$LCACHE:/cache" -v "$HOME/.ccache:/ccache" quay.io/pypa/manylinux2010_x86_64 /gevent/scripts/releases/$(basename $0)
docker run --rm -ti -v "$(pwd):/gevent" -v "$LCACHE:/cache" -v "$HOME/.ccache:/ccache" ${DOCKER_IMAGE:-quay.io/pypa/manylinux2010_x86_64} /gevent/scripts/releases/$(basename $0)
ls -l wheelhouse
......@@ -193,7 +193,7 @@ greenlet_requires = [
# since we compile cython code that extends the greenlet object.
# Binary compatibility would break if the greenlet struct changes.
# (Which it did in 0.4.14 for Python 3.7)
'greenlet >= 0.4.16; platform_python_implementation=="CPython"',
'greenlet >= 0.4.17; platform_python_implementation=="CPython"',
]
# Note that we don't add cffi to install_requires, it's
......
......@@ -42,6 +42,7 @@ from socket import SOL_SOCKET
from ssl import SSLWantReadError
from ssl import SSLWantWriteError
from ssl import SSLEOFError
from ssl import CERT_NONE
from ssl import SSLError
from ssl import SSL_ERROR_EOF
......@@ -628,9 +629,12 @@ class SSLSocket(socket):
if self.timeout == 0.0:
raise
self._wait(self._write_event)
except SSLEOFError:
break
except OSError as e:
if e.errno == 0:
# What does this even mean? Seen on 3.7+.
# The equivalent of SSLEOFError on unpatched versions of Python.
# https://bugs.python.org/issue31122
break
raise
......
......@@ -3,7 +3,8 @@
Cooperative ``contextvars`` module.
This module was added to Python 3.7. The gevent version is available
on all supported versions of Python.
on all supported versions of Python. However, see an important note
about gevent 20.9.
Context variables are like greenlet-local variables, just more
inconvenient to use. They were designed to work around limitations in
......@@ -23,6 +24,17 @@ from :pep:`567` and doesn't have much optimization. In particular, setting
context values isn't constant time.
.. versionadded:: 1.5a3
.. versionchanged:: NEXT
On Python 3.7 and above, this module is no longer monkey-patched
in place of the standard library version.
gevent depends on greenlet 0.4.17 which includes support for context variables.
This means that any number of greenlets can be running any number of asyncio tasks
each with their own context variables. This module is only greenlet aware, not
asyncio task aware, so its use is not recommended on Python 3.7 and above.
On previous versions of Python, this module continues to be a solution for
backporting code. It is also available if you wish to use the contextvar API
in a strictly greenlet-local manner.
"""
from __future__ import absolute_import
from __future__ import division
......
......@@ -157,6 +157,7 @@ else:
WIN = sys.platform.startswith("win")
PY36 = sys.version_info[:2] >= (3, 6)
PY37 = sys.version_info[:2] >= (3, 7)
class _BadImplements(AttributeError):
"""
......@@ -583,7 +584,16 @@ def patch_contextvars():
.. versionchanged:: 20.04.0
Clarify that the backport is also patched.
.. versionchanged:: NEXT
This now does nothing on Python 3.7 and above.
gevent now depends on greenlet 0.4.17, which
natively handles switching context vars when greenlets are switched.
Older versions of Python that have the backport installed will
still be patched.
"""
if PY37:
return
try:
__import__('contextvars')
except ImportError:
......
......@@ -235,11 +235,14 @@ disabled_tests = [
# and this doesn't work reliably on all versions.
'test_httplib.HeaderTests.test_headers_debuglevel',
# These depend on the exact error message produced by the interpreter
# when too many arguments are passed to functions. We can't match
# the exact signatures (because Python 2 doesn't support the syntax)
'test_context.ContextTest.test_context_new_1',
'test_context.ContextTest.test_context_var_new_1',
# On Appveyor with Python 3.8.0 and 3.7.5, this test
# for __class_getitem__ fails. Presumably this was added
# in a patch release (it's not in the PEP.) Sigh.
# https://bugs.python.org/issue38979
'test_context.ContextTest.test_contextvar_getitem',
# The same patch that fixed that removed this test,
# because it would now fail.
'test_context.ContextTest.test_context_var_new_2',
]
if OSX:
......
This diff is collapsed.
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