Error converting Pyrex file to C:
------------------------------------------------------------
...
self.params[name] = value
# Store the converted parameter in our parameter list so we can
# free() it later.
if data != NULL:
pn = <_mssql_parameter_node *>PyMem_Malloc(sizeof(_mssql_parameter_node))
^
------------------------------------------------------------
/home/rayvd/src/fedora/pymssql/f14/pymssql-1.9.908/_mssql.pyx:1103:54: undeclared name not builtin: PyMem_Malloc
(There are many more like this).
I'm not Cython expert, but anyone know where to start tracking this
down? I'll see if I can find where PyMem_Malloc should live, but
hopefully someone out there can point me in the right direction.
Thanks,
Ray
The following _almost_ fixes the problem:
--- pymssql-1.9.908/_mssql.pyx 2010-04-28 03:09:12.000000000 -0700
+++ pymssql-1.9.908.new/_mssql.pyx 2010-10-17 14:49:22.000000000 -0700
@@ -30,7 +30,7 @@
DEF PYMSSQL_MSGSIZE = (MSSQLDB_MSGSIZE * 8)
DEF EXCOMM = 9
-from python_version cimport PY_MAJOR_VERSION, PY_MINOR_VERSION
+from cpython cimport PY_MAJOR_VERSION, PY_MINOR_VERSION
if PY_MAJOR_VERSION >= 2 and PY_MINOR_VERSION >= 5:
import uuid
@@ -38,10 +38,10 @@
import decimal
import datetime
from sqlfront cimport *
-from stdio cimport fprintf, sprintf, FILE
-from stdlib cimport strlen, strcpy
-from python_mem cimport PyMem_Malloc, PyMem_Free
-from python_long cimport PY_LONG_LONG
+from libc.stdio cimport fprintf, sprintf, FILE
+from libc.string cimport strlen, strcpy
+from cpython cimport PyMem_Malloc, PyMem_Free
+from cpython cimport PY_LONG_LONG
cdef extern from "stdio.h" nogil:
cdef FILE *stderr
However, I still get the following:
running build
running build_ext
cythoning _mssql.pyx to _mssql.c
Error converting Pyrex file to C:
------------------------------------------------------------
...
if strlen(self._charset) > 0 and type(value) is unicode:
value = value.encode(self._charset)
strValue = <char *>PyMem_Malloc(len(value) + 1)
strcpy(strValue, value)
^
------------------------------------------------------------
/home/rayvd/src/fedora/pymssql/f14/pymssql-1.9.908/_mssql.pyx:650:34: Cannot convert Python object to 'const_char *'
building '_mssql' extension
The code in setup.py this is complaining about appears to make every
effort to ensure that "value" is a string, so I'm not sure why strcpy
is mad.
Maybe a question for the Cython folks.
Ray