Add Python 3.8 support: use CodeType.replace() if available

Backport upstream change:
806713333a

Remove also 0001-always-obey-GEVENT_NO_CFFI_BUILD.patch, the change
has bene merged into gevent 1.3:
14b28c678f
epel9
Victor Stinner 6 years ago
parent 1c32ec07c1
commit 9ac63267e9

@ -1,42 +0,0 @@
From 05650624fe2524ecb1bdbbd4facc5d988275e542 Mon Sep 17 00:00:00 2001
From: Dan Callaghan <dcallagh@redhat.com>
Date: Wed, 7 Jun 2017 13:55:53 +1000
Subject: [PATCH] always obey GEVENT_NO_CFFI_BUILD
If libev is not embedded, we still want to set GEVENT_NO_CFFI_BUILD=1 to
prevent setup.py from trying to configure libev, regardless whether cffi
modules will actually be built or not.
---
setup.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/setup.py b/setup.py
index 9c229ad..ea4dcaf 100755
--- a/setup.py
+++ b/setup.py
@@ -90,16 +90,17 @@
except ImportError:
pass
else:
- if IGNORE_CFFI and not PYPY:
- # Allow distributors to turn off CFFI builds
- # even if it's available, because CFFI always embeds
- # our copy of libev and they may not want that.
- del cffi_modules[:]
# Note that we don't add cffi to install_requires, it's
# optional. We tend to build and distribute wheels with the CFFI
# modules built and they can be imported if CFFI is installed.
# install_requires.append('cffi >= 1.3.0')
+ pass
+if IGNORE_CFFI and not PYPY:
+ # Allow distributors to turn off CFFI builds
+ # even if it's available, because CFFI always embeds
+ # our copy of libev and they may not want that.
+ del cffi_modules[:]
# If we are running info / help commands, or we're being imported by
# tools like pyroma, we don't need to build anything
--
2.9.4

@ -0,0 +1,26 @@
commit 1b84da94c2aa2d171881482c22298ad189b79764
Author: Victor Stinner <vstinner@redhat.com>
Date: Tue Jun 11 16:38:52 2019 +0200
Use CodeType.replace() if available
Port _tblib.Traceback to Python 3.8: use code.replace() method if
available.
diff --git a/src/gevent/_tblib.py b/src/gevent/_tblib.py
index 13364012..b9553a9e 100644
--- a/src/gevent/_tblib.py
+++ b/src/gevent/_tblib.py
@@ -198,7 +198,11 @@ class Traceback(object):
while current:
f_code = current.tb_frame.f_code
code = compile('\n' * (current.tb_lineno - 1) + 'raise __traceback_maker', current.tb_frame.f_code.co_filename, 'exec')
- if PY3:
+ if hasattr(code, "replace"):
+ # Python 3.8 and newer
+ code = code.replace(co_argcount=0,
+ co_freevars=(), co_cellvars=())
+ elif PY3:
code = CodeType(
0, code.co_kwonlyargcount,
code.co_nlocals, code.co_stacksize, code.co_flags,

@ -4,13 +4,18 @@
Name: python-%{modname} Name: python-%{modname}
Version: 1.3.6 Version: 1.3.6
Release: 2%{?dist} Release: 3%{?dist}
Summary: A coroutine-based Python networking library Summary: A coroutine-based Python networking library
License: MIT License: MIT
URL: http://www.gevent.org/ URL: http://www.gevent.org/
Source0: https://files.pythonhosted.org/packages/source/g/%{modname}/%{modname}-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/g/%{modname}/%{modname}-%{version}.tar.gz
# Python 3.8 compatibility: use code.replace() method
# https://github.com/gevent/gevent/pull/1429
# https://github.com/gevent/gevent/commit/806713333afa9d490d31c0f9b534031c07467fc7
Patch1: 0001-code-replace.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: c-ares-devel BuildRequires: c-ares-devel
BuildRequires: libev-devel BuildRequires: libev-devel
@ -74,7 +79,7 @@ Features include:
Python 3 version. Python 3 version.
%prep %prep
%autosetup -n %{modname}-%{version} %autosetup -p1 -n %{modname}-%{version}
# Remove bundled libraries # Remove bundled libraries
rm -r deps rm -r deps
# Upstream intentionally includes C extension sources in the built package, # Upstream intentionally includes C extension sources in the built package,
@ -117,6 +122,10 @@ find %{buildroot} -name '*.so' -exec chmod 755 {} ';'
%{python3_sitearch}/%{modname}* %{python3_sitearch}/%{modname}*
%changelog %changelog
* Tue Jun 11 2019 Victor Stinner <vstinner@redhat.com> - 1.3.6-3
- Add Python 3.8 support, backport upstream change to use CodeType.replace() if
available (rhbz#1716342)
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.6-2 * Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

Loading…
Cancel
Save