From 5091aefd9c5f356b0f317dfcf37239b5bfdad5b6 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 22 Aug 2008 09:08:07 +0200 Subject: [PATCH] changed Python C-API usage test case to test includes from Cython/Includes/, currently fails: are cimports in .pxd files not re-exported? --- tests/run/r_pythonapi.pyx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/run/r_pythonapi.pyx b/tests/run/r_pythonapi.pyx index edf3ddaa..9fda34a6 100644 --- a/tests/run/r_pythonapi.pyx +++ b/tests/run/r_pythonapi.pyx @@ -1,20 +1,19 @@ __doc__ = u""" >>> x = spam() >>> print(repr(x)) - b'Ftang\\x00Ftang!' + u'Ftang\\x00Ftang!' """ import sys -if sys.version_info[0] < 3: - __doc__ = __doc__.replace(u" b'", u" '") +if sys.version_info[0] >= 3: + __doc__ = __doc__.replace(u" u'", u" '") cdef extern from "string.h": void memcpy(char *d, char *s, int n) -cdef extern from "Python.h": - object PyString_FromStringAndSize(char *s, int len) +from python cimport PyUnicode_DecodeUTF8 def spam(): cdef char buf[12] memcpy(buf, "Ftang\0Ftang!", sizeof(buf)) - return PyString_FromStringAndSize(buf, sizeof(buf)) + return PyUnicode_DecodeUTF8(buf, sizeof(buf), NULL) -- 2.26.2