Lisandro Dalcin | 12 Aug 19:44

[Cython] py3k patch, changes in PyUnicode API

I've just updated py3k following the trunk:
PyUnicode_AsString[AndSize] are no longer available (well, we can
still access it prefixing with _PyXXX, but this is marked as
deprecated). So we are going to need the attached patch. Note however
that I've not tested if the %U format specifier is available in latest
oficial beta release.

-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
diff -r 458af4830356 Cython/Compiler/Nodes.py
--- a/Cython/Compiler/Nodes.py	Tue Aug 12 17:29:06 2008 +0200
+++ b/Cython/Compiler/Nodes.py	Tue Aug 12 14:13:28 2008 -0300
@@ -4274,11 +4274,12 @@ static int __Pyx_CheckKeywordStrings(
     }
     if (unlikely(!kw_allowed) && unlikely(key)) {
         PyErr_Format(PyExc_TypeError,
+        #if PY_MAJOR_VERSION < 3
                      "'%s' is an invalid keyword argument for this function",
-        #if PY_MAJOR_VERSION < 3
                      PyString_AsString(key));
         #else
-                     PyUnicode_AsString(key));
(Continue reading)

Stefan Behnel | 12 Aug 21:25

Re: [Cython] py3k patch, changes in PyUnicode API

Hi,

thanks for the patch.

Lisandro Dalcin wrote:
> PyUnicode_AsString[AndSize] are no longer available (well, we can
> still access it prefixing with _PyXXX, but this is marked as
> deprecated). So we are going to need the attached patch. Note however
> that I've not tested if the %U format specifier is available in latest
> oficial beta release.

Works for me in Py3b2. Applied to cython-devel.

Stefan


Gmane