Commit 3294ebbc authored by Jason Madden's avatar Jason Madden Committed by GitHub

Merge pull request #1603 from gevent/issue1599

Fix compilation with Cython 3
parents 80a66d6d 505b55a8
......@@ -174,7 +174,7 @@ jobs:
# First, the build dependencies (see setup.cfg)
# so that we don't have to use build isolation and can better use the cache;
# Note that we can't use -U for cffi and greenlet on PyPy.
- &build-gevent-deps pip install -U setuptools wheel twine && pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"' 'cffi;platform_python_implementation=="CPython"' cython 'greenlet;platform_python_implementation=="CPython"'
- &build-gevent-deps pip install -U setuptools wheel twine && pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"' 'cffi;platform_python_implementation=="CPython"' 'cython<3' 'greenlet;platform_python_implementation=="CPython"'
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
# output (pip install uses a random temporary directory, making this difficult)
- python setup.py bdist_wheel
......
gevent can now be built using Cython 3.0a2 and newer.
The libev extension was incompatible with this. As part of this,
certain internal, undocumented names have been changed.
However, up through at least 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>`_.
......@@ -13,8 +13,10 @@ requires = [
# name to be created so that we can have both foo.py and _foo.so
# at the same time. 0.29 fixes some issues with Python 3.7,
# and adds the 3str mode for transition to Python 3. 0.29.14+ is
# required for Python 3.8. As of now, we can't build with Cython 3.0a3
# https://github.com/gevent/gevent/issues/1599
# required for Python 3.8. 3.0a2 introduced a change that prevented
# us from compiling (https://github.com/gevent/gevent/issues/1599)
# but once that was fixed, 3.0a4 led to all of our leak tests
# failing in Python 2 (https://travis-ci.org/github/gevent/gevent/jobs/683782800)
"Cython >= 0.29.14, < 3",
# See version requirements in setup.py
"cffi >= 1.12.3 ; platform_python_implementation == 'CPython'",
......
This diff is collapsed.
......@@ -255,7 +255,7 @@ class loop(AbstractLoop):
ptr = libev.ev_loop_new(c_flags)
if not ptr:
raise SystemError("ev_loop_new(%s) failed" % (c_flags, ))
if default or globals()["__SYSERR_CALLBACK"] is None:
if default or SYSERR_CALLBACK is None:
set_syserr_cb(self._handle_syserr)
# Mark this loop as being used.
......@@ -299,7 +299,7 @@ class loop(AbstractLoop):
if self._ptr:
super(loop, self).destroy()
# pylint:disable=comparison-with-callable
if globals()["__SYSERR_CALLBACK"] == self._handle_syserr:
if globals()["SYSERR_CALLBACK"] == self._handle_syserr:
set_syserr_cb(None)
......@@ -425,23 +425,23 @@ class loop(AbstractLoop):
def _syserr_cb(msg):
try:
msg = ffi.string(msg)
__SYSERR_CALLBACK(msg, ffi.errno)
SYSERR_CALLBACK(msg, ffi.errno)
except:
set_syserr_cb(None)
raise # let cffi print the traceback
def set_syserr_cb(callback):
global __SYSERR_CALLBACK
global SYSERR_CALLBACK
if callback is None:
libev.ev_set_syserr_cb(ffi.NULL)
__SYSERR_CALLBACK = None
SYSERR_CALLBACK = None
elif callable(callback):
libev.ev_set_syserr_cb(libev._syserr_cb)
__SYSERR_CALLBACK = callback
SYSERR_CALLBACK = callback
else:
raise TypeError('Expected callable or None, got %r' % (callback, ))
__SYSERR_CALLBACK = None
SYSERR_CALLBACK = None
LIBEV_EMBED = libev.LIBEV_EMBED
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