python-gevent: fix build with Cython 0.26

This commit is contained in:
Alessio Sergi 2017-08-28 10:50:55 +02:00
parent d1392394fb
commit aa38299287

View file

@ -0,0 +1,62 @@
From 4c25c7de7bca39b753e177837fa1bdff0fb7ecf1 Mon Sep 17 00:00:00 2001
From: Jason Madden <jamadden@gmail.com>
Date: Thu, 20 Jul 2017 08:03:06 -0500
Subject: [PATCH] Disable auto-pickling to work around
https://github.com/cython/cython/issues/1786. We don't want to allow that in
a point-release of gevent anyway.
---
src/gevent/_semaphore.pxd | 1 +
src/gevent/_semaphore.py | 1 +
src/gevent/ares.pyx | 5 +++++
src/gevent/libev/corecext.ppyx | 5 +++--
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git src/gevent/_semaphore.pxd src/gevent/_semaphore.pxd
index 6382d560..1d66da76 100644
--- src/gevent/_semaphore.pxd
+++ src/gevent/_semaphore.pxd
@@ -1,3 +1,4 @@
+# cython: auto_pickle=False
cdef class Semaphore:
cdef public int counter
cdef readonly object _links
diff --git src/gevent/_semaphore.py src/gevent/_semaphore.py
index c6e11622..28b7d085 100644
--- src/gevent/_semaphore.py
+++ src/gevent/_semaphore.py
@@ -1,3 +1,4 @@
+# cython: auto_pickle=False
import sys
from gevent.hub import get_hub, getcurrent
from gevent.timeout import Timeout
diff --git src/gevent/ares.pyx src/gevent/ares.pyx
index 92832cc2..ce675d80 100644
--- src/gevent/ares.pyx
+++ src/gevent/ares.pyx
@@ -1,4 +1,9 @@
# Copyright (c) 2011-2012 Denis Bilenko. See LICENSE for details.
+# Automatic pickling of cdef classes was added in 0.26. Unfortunately it
+# seems to be buggy (at least for the `result` class) and produces code that
+# can't compile ("local variable 'result' referenced before assignment").
+# See https://github.com/cython/cython/issues/1786
+# cython: auto_pickle=False
cimport cares
import sys
from python cimport *
diff --git src/gevent/libev/corecext.ppyx src/gevent/libev/corecext.ppyx
index a474d7e2..f7a6caae 100644
--- src/gevent/libev/corecext.ppyx
+++ src/gevent/libev/corecext.ppyx
@@ -1,8 +1,9 @@
# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details.
# This directive, supported in Cython 0.24+, causes sources files to be
# much smaller and thus cythonpp.py to be slightly faster. But it does make
-# debugging more difficult.
-# cython: emit_code_comments=False
+# debugging more difficult. Auto-pickling was added in 0.26, and that's a new feature
+# that we don't need or want to allow in a gevent point release.
+# cython: emit_code_comments=False, auto_pickle=False
cimport cython
cimport libev
# Note this is not the standard cython 'cpython' (which has a backwards compat alias of 'python')