[Cython] Fixing NumPy support for Python 3 (Stefan, please help!)
Lisandro Dalcin
dalcinl at gmail.com
Thu Feb 17 15:32:28 CET 2011
Stefan, what do you think about the patch below? This hunk is part of
a series of fixes required to get numpy-dev working under Python 3.2.
The root of the issue is that __cythonbufferdefaults__ keys&values
end-up being "bytes" (this coercion is triggered in Interpreter.py).
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index 5b339da..b72deef 100755
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -12,6 +12,7 @@ cython.declare(error=object, warning=object, warn_once=object,
Builtin=object, Symtab=object, Utils=object, find_coercion_error
debug_disposal_code=object, debug_temp_alloc=object, debug_coerc
+import sys
import operator
from Errors import error, warning, warn_once, InternalError, CompileError
@@ -1136,6 +1137,8 @@ class StringNode(PyConstNode):
return self.result_code
def compile_time_value(self, env):
+ if sys.version_info[0] >= 3 and self.unicode_value:
+ return self.unicode_value
return self.value
--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
More information about the cython-devel
mailing list