Commit 1ef22cc9 authored by Jason Madden's avatar Jason Madden

Fix compilation with Cython 3.

The double-dunder name changes broke some things.

Fixes #1599
parent 80a66d6d
...@@ -174,7 +174,7 @@ jobs: ...@@ -174,7 +174,7 @@ jobs:
# First, the build dependencies (see setup.cfg) # First, the build dependencies (see setup.cfg)
# so that we don't have to use build isolation and can better use the cache; # 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. # 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.0a4' 'greenlet;platform_python_implementation=="CPython"'
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure # 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) # output (pip install uses a random temporary directory, making this difficult)
- python setup.py bdist_wheel - python setup.py bdist_wheel
......
...@@ -172,7 +172,7 @@ build_script: ...@@ -172,7 +172,7 @@ build_script:
# Build the compiled extension # Build the compiled extension
# Try to get some things that don't wind up in the pip cache as # Try to get some things that don't wind up in the pip cache as
# built wheels if they're built during an isolated build. # built wheels if they're built during an isolated build.
- "%CMD_IN_ENV% %PYEXE% -m pip install -U wheel cython setuptools cffi" - "%CMD_IN_ENV% %PYEXE% -m pip install -U --pre wheel cython setuptools cffi"
- if not "%GWHEEL_ONLY%"=="true" %PYEXE% -m pip install -U -e .[test] - if not "%GWHEEL_ONLY%"=="true" %PYEXE% -m pip install -U -e .[test]
test_script: test_script:
......
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.
...@@ -13,9 +13,8 @@ requires = [ ...@@ -13,9 +13,8 @@ requires = [
# name to be created so that we can have both foo.py and _foo.so # 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, # 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 # 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 # required for Python 3.8.
# https://github.com/gevent/gevent/issues/1599 "Cython >= 3.0a4",
"Cython >= 0.29.14, < 3",
# See version requirements in setup.py # See version requirements in setup.py
"cffi >= 1.12.3 ; platform_python_implementation == 'CPython'", "cffi >= 1.12.3 ; platform_python_implementation == 'CPython'",
# Python 3.7 requires at least 0.4.14, which is ABI incompatible with earlier # Python 3.7 requires at least 0.4.14, which is ABI incompatible with earlier
......
This diff is collapsed.
...@@ -255,7 +255,7 @@ class loop(AbstractLoop): ...@@ -255,7 +255,7 @@ class loop(AbstractLoop):
ptr = libev.ev_loop_new(c_flags) ptr = libev.ev_loop_new(c_flags)
if not ptr: if not ptr:
raise SystemError("ev_loop_new(%s) failed" % (c_flags, )) 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) set_syserr_cb(self._handle_syserr)
# Mark this loop as being used. # Mark this loop as being used.
...@@ -299,7 +299,7 @@ class loop(AbstractLoop): ...@@ -299,7 +299,7 @@ class loop(AbstractLoop):
if self._ptr: if self._ptr:
super(loop, self).destroy() super(loop, self).destroy()
# pylint:disable=comparison-with-callable # pylint:disable=comparison-with-callable
if globals()["__SYSERR_CALLBACK"] == self._handle_syserr: if globals()["SYSERR_CALLBACK"] == self._handle_syserr:
set_syserr_cb(None) set_syserr_cb(None)
...@@ -425,23 +425,23 @@ class loop(AbstractLoop): ...@@ -425,23 +425,23 @@ class loop(AbstractLoop):
def _syserr_cb(msg): def _syserr_cb(msg):
try: try:
msg = ffi.string(msg) msg = ffi.string(msg)
__SYSERR_CALLBACK(msg, ffi.errno) SYSERR_CALLBACK(msg, ffi.errno)
except: except:
set_syserr_cb(None) set_syserr_cb(None)
raise # let cffi print the traceback raise # let cffi print the traceback
def set_syserr_cb(callback): def set_syserr_cb(callback):
global __SYSERR_CALLBACK global SYSERR_CALLBACK
if callback is None: if callback is None:
libev.ev_set_syserr_cb(ffi.NULL) libev.ev_set_syserr_cb(ffi.NULL)
__SYSERR_CALLBACK = None SYSERR_CALLBACK = None
elif callable(callback): elif callable(callback):
libev.ev_set_syserr_cb(libev._syserr_cb) libev.ev_set_syserr_cb(libev._syserr_cb)
__SYSERR_CALLBACK = callback SYSERR_CALLBACK = callback
else: else:
raise TypeError('Expected callable or None, got %r' % (callback, )) raise TypeError('Expected callable or None, got %r' % (callback, ))
__SYSERR_CALLBACK = None SYSERR_CALLBACK = None
LIBEV_EMBED = libev.LIBEV_EMBED 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