Commit a597d1b6 authored by Boxiang Sun's avatar Boxiang Sun

Update Cython from 0.22 to 0.24

parent 2190118b
...@@ -5,20 +5,20 @@ from test_helper import create_virtenv, run_test ...@@ -5,20 +5,20 @@ from test_helper import create_virtenv, run_test
ENV_NAME = "lxml_test_env_" + os.path.basename(sys.executable) ENV_NAME = "lxml_test_env_" + os.path.basename(sys.executable)
SRC_DIR = os.path.abspath(os.path.join(ENV_NAME, "src")) SRC_DIR = os.path.abspath(os.path.join(ENV_NAME, "src"))
CYTHON_DIR = os.path.abspath(os.path.join(SRC_DIR, "cython"))
PYTHON_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "python")) PYTHON_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "python"))
def install_and_test_lxml(): def install_and_test_lxml():
shutil.rmtree(SRC_DIR, ignore_errors=True) shutil.rmtree(SRC_DIR, ignore_errors=True)
os.makedirs(SRC_DIR) os.makedirs(SRC_DIR)
url = "https://github.com/cython/cython/archive/0.22.tar.gz" url = "https://github.com/cython/cython"
subprocess.check_call(["wget", url, "-O", "Cython-0.22.tar.gz"], cwd=SRC_DIR) subprocess.check_call(["git", "clone", "--depth", "1", "--branch", "0.24", url], cwd=SRC_DIR)
subprocess.check_call(["tar", "-zxf", "Cython-0.22.tar.gz"], cwd=SRC_DIR)
CYTHON_DIR = os.path.abspath(os.path.join(SRC_DIR, "cython-0.22")) PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "../integration/Cython-0.24.patch"))
PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "integration", "Cython-0.22.patch"))
subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=CYTHON_DIR) subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=CYTHON_DIR)
print "Applied Cython patch" print ">>> Applied Cython patch"
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=CYTHON_DIR) subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=CYTHON_DIR)
subprocess.check_call([PYTHON_EXE, "-c", "import Cython"], cwd=CYTHON_DIR) subprocess.check_call([PYTHON_EXE, "-c", "import Cython"], cwd=CYTHON_DIR)
...@@ -33,7 +33,7 @@ def install_and_test_lxml(): ...@@ -33,7 +33,7 @@ def install_and_test_lxml():
subprocess.check_call([PYTHON_EXE, "setup.py", "build_ext", "-i", "--with-cython"], cwd=LXML_DIR) subprocess.check_call([PYTHON_EXE, "setup.py", "build_ext", "-i", "--with-cython"], cwd=LXML_DIR)
expected = [{'ran': 1381, 'failures': 1}] expected = [{'ran': 1381}]
run_test([PYTHON_EXE, "test.py"], cwd=LXML_DIR, expected=expected) run_test([PYTHON_EXE, "test.py"], cwd=LXML_DIR, expected=expected)
create_virtenv(ENV_NAME, None, force_create = True) create_virtenv(ENV_NAME, None, force_create = True)
......
...@@ -22,18 +22,17 @@ test_helper.create_virtenv(ENV_NAME, DEPENDENCIES) ...@@ -22,18 +22,17 @@ test_helper.create_virtenv(ENV_NAME, DEPENDENCIES)
SRC_DIR = ENV_NAME SRC_DIR = ENV_NAME
ENV_DIR = os.path.abspath(ENV_NAME) ENV_DIR = os.path.abspath(ENV_NAME)
PYTHON_EXE = os.path.abspath(ENV_NAME + "/bin/python") PYTHON_EXE = os.path.abspath(ENV_NAME + "/bin/python")
CYTHON_DIR = os.path.abspath(os.path.join(SRC_DIR, "cython-0.22")) CYTHON_DIR = os.path.abspath(os.path.join(SRC_DIR, "cython"))
NUMPY_DIR = os.path.abspath(os.path.join(SRC_DIR, "numpy")) NUMPY_DIR = os.path.abspath(os.path.join(SRC_DIR, "numpy"))
print_progress_header("Setting up Cython...") print_progress_header("Setting up Cython...")
if not os.path.exists(CYTHON_DIR): if not os.path.exists(CYTHON_DIR):
url = "https://github.com/cython/cython/archive/0.22.tar.gz" url = "https://github.com/cython/cython"
subprocess.check_call(["wget", url, "-O", "Cython-0.22.tar.gz"], cwd=SRC_DIR) subprocess.check_call(["git", "clone", "--depth", "1", "--branch", "0.24", url], cwd=SRC_DIR)
subprocess.check_call(["tar", "-zxf", "Cython-0.22.tar.gz"], cwd=SRC_DIR)
if USE_CUSTOM_PATCHES: if USE_CUSTOM_PATCHES:
PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "../integration/Cython-0.22.patch")) PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "../integration/Cython-0.24.patch"))
subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=CYTHON_DIR) subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=CYTHON_DIR)
print ">>> Applied Cython patch" print ">>> Applied Cython patch"
......
From eaf300b61a56af151e93aa51803e6a61a0f8afee Mon Sep 17 00:00:00 2001
From: Marius Wachtler <undingen@gmail.com>
Date: Fri, 6 May 2016 16:19:50 +0100
Subject: [PATCH] [PATCH] Pyston change: make cython work with pyston
---
Cython/Compiler/ExprNodes.py | 9 +++++++++
Cython/Utility/CythonFunction.c | 4 +++-
Cython/Utility/Exceptions.c | 4 +++-
Cython/Utility/ModuleSetupCode.c | 2 +-
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index f99ec6e..7ab41f3 100644
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -7784,12 +7784,21 @@ class PyCFunctionNode(ExprNode, ModuleNameMixin):
@classmethod
def from_defnode(cls, node, binding):
+ """
+ # Pyston change: dont't generate custom code objects because we don't support them currently
return cls(node.pos,
def_node=node,
pymethdef_cname=node.entry.pymethdef_cname,
binding=binding or node.specialized_cpdefs,
specialized_cpdefs=node.specialized_cpdefs,
code_object=CodeObjectNode(node))
+ """
+ return cls(node.pos,
+ def_node=node,
+ pymethdef_cname=node.entry.pymethdef_cname,
+ binding=binding or node.specialized_cpdefs,
+ specialized_cpdefs=node.specialized_cpdefs,
+ code_object=None)
def analyse_types(self, env):
if self.binding:
diff --git a/Cython/Utility/CythonFunction.c b/Cython/Utility/CythonFunction.c
index 9cc38f0..ab05ad1 100644
--- a/Cython/Utility/CythonFunction.c
+++ b/Cython/Utility/CythonFunction.c
@@ -561,7 +561,9 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
#endif
}
-#if CYTHON_COMPILING_IN_PYPY
+// Pyston change:
+// #if CYTHON_COMPILING_IN_PYPY
+#if 0 && CYTHON_COMPILING_IN_PYPY
// originally copied from PyCFunction_Call() in CPython's Objects/methodobject.c
// PyPy does not have this function
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
diff --git a/Cython/Utility/Exceptions.c b/Cython/Utility/Exceptions.c
index 354a776..567970d 100644
--- a/Cython/Utility/Exceptions.c
+++ b/Cython/Utility/Exceptions.c
@@ -528,7 +528,9 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
- py_frame->f_lineno = py_line;
+ // Pyston change:
+ // py_frame->f_lineno = py_line;
+ PyFrame_SetLineNumber(py_frame, py_line);
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_code);
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 6477fb2..75dcdda 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -32,7 +32,7 @@
#define Py_HUGE_VAL HUGE_VAL
#endif
-#ifdef PYPY_VERSION
+#if defined(PYPY_VERSION) || defined(PYSTON_VERSION)
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
--
1.9.1
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